例如,如果页面上只有一个图像具有属性 aria-disabled = "true",如何使用 jquery 选择器来获取此元素?请注意,并非所有图像都具有 aria-disabled ,其中一些没有此属性,其中一些具有 aria-disabled = "false"。只有一个 图像具有 aria-disabled = "true"。谢谢
例如。
$(img : aria-disabled = "true").attr(id);
当然这应该是无效的synatx
最佳答案
试试这个
$('img[aria-disabled="true"]').attr('id');
关于javascript - JQuery 选择器 : How to get a img id that have an one and only one attribute,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14497417/