我有一个div,它显示动态创建的表(实际上是在asp.net中继器中)。表的数目可以根据它从数据库中获取的项而有所不同。我在下面给出了一个带有css和jquery代码的示例标记。同样,该表将被动态创建。我刚刚给了两个,里面没有包括标记。
.todotable{border-bottom:1px solid white;}
<div id="divalert">
<table></table>
<table></table>
</div>
$(document).ready(function () {
$("#divalert").last().css("border-bottom", "none");
});我的问题是,如何删除最后一个表的边框?
发布于 2012-04-26 16:34:31
您尚未选择该表。试试下面的其中一种:
$("#divalert :last-child").css("border-bottom", "none");
// or
$("#divalert table").last().css("border-bottom", "none");
$("#divalert table:last").css("border-bottom", "none"); // same as above发布于 2012-04-26 16:42:16
我宁愿使用CSS来完成这项工作。在CSS可用的情况下使用JS从来都不是一个好主意:-)
#divalert table:last-child {
border-bottom: none;
}https://stackoverflow.com/questions/10329806
复制相似问题