I wan to add a css class for all elements that has particular style.
Eg. if there are 5 elements that with the style "float:left".
I want to remove the "float:left" and add "align-left" class.
please help me
I wan to add a css class for all elements that has particular style.
Eg. if there are 5 elements that with the style "float:left".
I want to remove the "float:left" and add "align-left" class.
please help me
The way to do it is to use filter() like below, but the target selector *
is a bad one, so try to have better selector to target the desired elements
$('*').filter(function () {
return this.style.float == 'left'
}).css('float', '').addClass('align-left')
You can also use this:
if( $("#test").css('display') == 'block') {
// Remove and add properties here
}
Thanks to Pekka in his answer to this SO question!