How to know how many of a particular kind of element exist in the current web page in Jquery?
There are many <label name="delQ" style="cursor:pointer">Remove</label>
elements in a web page; the elements are dynamically created. How to determine how many "delQ" exist in the current web page?
$('[name="delQ"]').live('click', function() {
//Get the number of name="delQ" in the current we开发者_StackOverflow社区b page.
});
How to do it in Jquery?
$('label[name="delQ"]').length;
length
Returns the number of elements in the jQuery object.
精彩评论