Jquery find element with style attr and change it

Gnesh

I have:

<div style="color:red">
  some text
</div>
<div style="color:green; height:100px;">
  some more text
</div>

And I want to select div with style color:green;height:100px; and change it to lets say color:blue; height:10px;

I've tried:

$("div").each(function(){
       if($(this).css("height")=="100px"){
          $(this).css("color","blue");
       }
    });

and

$("div").find(attr('style','color:green'))...

but with no luck

Steve Wellens

You could use wild cards:

$("div[style*=green][style*=100px]")...

Just make sure you don't accidentally get other elements.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

jQuery find style attr of ID

From Dev

jQuery - Find .attr of the last-child element

From Dev

Change parent element style with jQuery

From Dev

jQuery change inline style of multiple div element

From Dev

jQuery change html element style with page refresh

From Dev

jquery find element with class and style display:block

From Dev

In jQuery i cant find out how to change attr again and again

From Dev

Jquery element height as attr

From Dev

Jquery: find element in var and change text

From Dev

Jquery: find element in var and change text

From Dev

jquery change placeholder attr value

From Dev

jQuery find div with data attr

From Dev

how can change other selected element style using jquery

From Dev

Jquery - capture element by it's style property value and then change the value

From Dev

Use JQuery to change all element's css style in same class

From Dev

remove style attribute using attr jquery

From Dev

remove style attribute using attr jquery

From Dev

Jquery Clone element Style

From Dev

Conditional jQuery on element style

From Dev

change attr value of dom element copied in variable

From Dev

change the style of a checkbox with jquery

From Dev

jquery attr add id to existing element

From Dev

Getting element attribute with jQuery .attr() method

From Dev

How to get selected option element attr in jQuery?

From Dev

select specific element using jQuery attr() Method

From Dev

jQuery setting onclick attr of another element

From Dev

How to get selected option element attr in jQuery?

From Dev

jQuery element.closest(…).attr is not a function

From Dev

Jquery - find <input> with 'hidden' in form and change css in element before

Related Related

HotTag

Archive