如何根据他们的风格选择元素? [英] How do you select elements based on their style?
本文介绍了如何根据他们的风格选择元素?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
使用jQuery,您将如何找到具有特定样式的元素(例如: float:left
),无论它是内联样式还是在CSS中定义文件?
Using jQuery, how would you find elements which have a particular style (eg: float: left
), regardless of whether it's an inline style or one defined in a CSS file?
推荐答案
使用 filter function :
$('*').filter(function() {
return $(this).css('float') == 'left';
});
用适当的选择器替换*。
Replace '*' with the appropriate selectors for your case.
这篇关于如何根据他们的风格选择元素?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文