[英]jquery selectors
I am making a jquery plugin. 我正在制作一个jQuery插件。
You are given an object which contains several divs. 您将获得一个包含多个div的对象。
is there anyway to select the say, 3rd child div? 反正有选择说第三个孩子div吗?
.get()从零开始的整数,指示要检索的元素。
($('div').get(3));
选择第三个div:
$('div').eq(2)
you can give them a className and use each or simple select the div, and count your selections 您可以给他们一个className并使用每个或简单的选择div,然后计算您的选择
var n = 0
$("div div").each(function() {
n++;
if(n == 3){
$(this).html("do your thing");
}
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.