Domanda

How to select checkboxes with opacity: 0.5?

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

È stato utile?

Soluzione

try this:

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

Altri suggerimenti

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.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top