1. 程式人生 > >Jquery 獲取第一個子元素

Jquery 獲取第一個子元素

獲取元素

找到class="box-button"元素下的 div 的第一個 span 子元素,隱藏它。
$(".box-button").find("div span").first().hide();


找到 errInfo 標籤下,tbody 標籤裡的 tr 標籤(排除第一個) 的第四個 td 元素,並新增函式
$("#errInfo tbody tr:not(:first) td:nth-child(4)").each(function () {});


修改td 元素 的title的值
$(this).attr("title",  "xx");//修改title顯示