Question

How to select checkboxes with opacity: 0.5?

Selector :checkbox[style~='opacity: 0.5'] doesn't select them.

Was it helpful?

Solution

try this:

$('input').filter(function() {
     return $(this).css('opacity') == '0.5';
});

OTHER TIPS

The filter() method lets you write a function that will run for all the elements and will only include them in the result set if the function returns true.

$('input[type="checkbox"]').filter(function () {
    return $(this).css('opacity') == 0.5;
}).addClass('marked');​

This will add a "marked" class on every element with 0.5 opacity.

Note: You should use classes instead of manipulating and querying CSS directly from Javascript.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top