我尝试了以下 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/
3 回答
长风秋雁
TA贡献1757条经验 获得超7个赞
var replicaNodeName="192.168.42.151:8984_solr"; $(document.getElementById(replicaNodeName)).find(".trees_shard1_replica_n1").find("span").css({'border':'4px solid green'});
添加回答
举报
0/150
提交
取消