JQuery Selector Property

by Sanju 2012-09-14 15:52:33

JQuery Selector Property

jQuery provides a property which contains the selector that was used to start the chain.

$('#container li:first-child').selector // #container li:first-child
$('#container li').filter(':first-child').selector // #container li.filter(:first-child)


Although the examples above target the same element, the selectors are quite different. The second one is actually invalid – you can’t use it as the basis of a new jQuery object. It only shows that the filter method was used to narrow down the collection.
1073
like
0
dislike
0
mail
flag

You must LOGIN to add comments