Reputation: 92691
I am making a jquery plugin.
You are given an object which contains several divs.
is there anyway to select the say, 3rd child div?
Upvotes: 0
Views: 67
Reputation: 176956
.get() A zero-based integer indicating which element to retrieve.
($('div').get(3));
Upvotes: 1
Reputation: 78687
See .eq - remember it is 0 based
e.g for the third div in an object containing a list of elements
$someObject.find('div:eq(2)')
Upvotes: 5
Reputation: 9440
you can give them a className and use each or simple select the div, and count your selections
var n = 0
$("div div").each(function() {
n++;
if(n == 3){
$(this).html("do your thing");
}
});
Upvotes: -1