How do you select elements based on their style?

Using the filter function:

$('*').filter(function() {
     return $(this).css('float') == 'left';
});

Replace '*' with the appropriate selectors for your case.


This is gonna be slow. Like REALLY slow. If you know you need to select all elements with a given CSS style, you will see much better performance by applying a single additional css rule to each element, and then selecting by that rule.

It's going to be MUCH faster and more readable to boot.

CSS:

.float-left {float:left}

Javascript:

$('.float-left');