Javascript 使用jQuery通过缺少属性查找子元素
在jQuery中按属性查找元素很简单:Javascript 使用jQuery通过缺少属性查找子元素,javascript,jquery,html,Javascript,Jquery,Html,在jQuery中按属性查找元素很简单: $(parentElement).find('[attribute]'); 如何找到不具有特定属性的元素?这就是为什么要为 试试看 您可以使用:not,尽管过滤器很可能更快: $(parentElement).filter(function() { return !$(this).attr('attribute'); }); 或者,$(parentElement).find('[attribute]')。not([attribute]);拉贾普
$(parentElement).find('[attribute]');
如何找到不具有特定属性的元素?这就是为什么要为
试试看
您可以使用
:not
,尽管过滤器很可能更快:
$(parentElement).filter(function() {
return !$(this).attr('attribute');
});
或者,$(parentElement).find('[attribute]')。not([attribute]);拉贾普拉布胡是对的。看小提琴。Active-Inactive$('div:not([target=“_blank”])).css('font-weight','bold');
$(parentElement).filter(function() {
return !$(this).attr('attribute');
});