Javascript 如何检查图像是否具有属性?

Javascript 如何检查图像是否具有属性?,javascript,jquery,Javascript,Jquery,我有img标签列表,其中一些有属性style=display:none 例如: <img src="#"> <img src="#" style="display: none"> <img src="#"> <img src="#" style="display: none"> <img src="#" style="display: none"> <img src="#"> <img src="#" style="d

我有img标签列表,其中一些有属性style=display:none 例如:

<img src="#">
<img src="#" style="display: none">
<img src="#">
<img src="#" style="display: none">
<img src="#" style="display: none">
<img src="#">
<img src="#" style="display: none">
如何使用jQuery或javascript获取没有属性style=display:none的元素


UPD:我选择了具有特定源$img[src='1]的图像http://certain-source.jpg“]但其中一些具有string style=display:none,现在我必须选择不包含该字符串的图像。

检查图像是否可见:

$('img:visible')
这将是最简单的,检查确切的属性是另一个

$('img[style!="display: none"]')
基于样式的过滤也是一个选项

$('img').filter(function() {
    return this.style.display != 'none';
})

大概还有一百种其他的解决方案?

@adeneo给出了一个很好的答案

您也可以尝试使用过滤器

$("img").filter(function() {
 return $(this).css("display") == "none"});

也许,你还没有理解我。我必须选择img标记,它不包括任何其他属性,除了src=Read一个更新的问题我理解你的意思,并且style=display:none使元素不可见,jQuery有一个:visible选择器,所以你可以用它来选择可见的元素。