覆盖span元素的边框样式

我尝试了以下 JavaScript/jQuery 代码来更改边框粗细。


但这是行不通的。请帮我。


//$("span").css({"border":"4px solid green"});

document.getElementById("192.168.42.151:8984_solr").getElementsByClassName("trees_shard1_replica_n1").find("span").style.borderWidth = "thick";

.card {

  position: relative;

  display: inline-block;

  margin: 10px;

}


.card a {

  padding-right: 8px;

}


.card a span {

  border-radius: 1.25rem;

  border: 1px solid green;

}


.card a .replicaActive {

  color: transparent;

  background-color: transparent;

}


.card a .replicaLeader {

  background-color: #000;

}

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>

<div class="card">

  <div class="card-body" id="192.168.42.151:8984_solr">

    <a href="#" class="trees_shard1_replica_n1">

      <span class="badge replicaActive">0</span>

    </a>

  </div>

</div>

<div class="card">

  <div class="card-body" id="192.168.1.4:8983_solr">

    <a href="#" class="trees_shard1_replica_n3">

      <span class="badge replicaLeader">0</span>

    </a>

  </div>

</div>

镜像:https : //jsfiddle.net/amitkushwaha1710/asdxfc94/44/


九州编程
浏览 280回答 3
3回答

长风秋雁

var&nbsp;replicaNodeName="192.168.42.151:8984_solr"; $(document.getElementById(replicaNodeName)).find(".trees_shard1_replica_n1").find("span").css({'border':'4px&nbsp;solid&nbsp;green'});
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

JavaScript