如何知道Jquery当前网页中存在多少特定类型的元素?

时间:2009-11-28 07:26:25

标签: jquery jquery-selectors

有很多<label name="delQ" style="cursor:pointer">Remove</label> 网页中的元素;元素是动态创建的。如何确定当前网页中存在多少“delQ”?

$('[name="delQ"]').live('click', function() {
//Get the number of name="delQ" in the current web page.
});

如何在Jquery中完成?

1 个答案:

答案 0 :(得分:0)

$('label[name="delQ"]').length;

length

  

返回。中元素的数量   jQuery对象。