请帮忙解决问题
页面上有几个img。有些具有属性
style="line-height: 1.538em; float: right;"
,有些有属性
style="line-height: 1.538em; float: left;"
我想js或jquery只选择那些float: right的img;
最佳答案
在此模式下,您将循环 dom 内的每个图像,并仅使用 css 搜索元素图像: float:left
试试这个:
$('img').each(function(index){
if(this.style.cssFloat =='left'){
//your code here
}
});
关于javascript - 选择样式属性的规则之一,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18041906/