问题描述
我发现了许多示例,这些示例通过属性值BUT而不是名称来查找元素.我想查找包含deleteuserid
的属性的所有元素(可以是链接,按钮等).我试过了:
I found many example finding elements by attribute value BUT not with name. I want to find all elements (can be link, button, anything) with the attribute containing deleteuserid
. I tried this:
console.log($('[deleteuserid!=""]'));
但是找到了所有内容,甚至都没有包含deleteuserid
属性...
but this find "everything" which not even containing the deleteuserid
attribute...
类似这样的内容: jQuery如何基于数据属性值查找元素?期望我没有具体的值(换句话说,我想找到$("ul").find("[data-slide=*]");
something like this: jQuery how to find an element based on a data-attribute value? expect that I dont have a concrete value (in other words, I want to find $("ul").find("[data-slide=*]");
推荐答案
只需使用deleteuserid
代替deleteuserid!=""
,如下所示.
Simply use deleteuserid
instead of deleteuserid!=""
like following.
console.log($('[deleteuserid]'));
这篇关于jQuery,如何通过属性NAME查找元素?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!