2016-03-25 17 views
0

Ben bunu değiştirmek:jQuery tarzı attr ile eleman bulmak ve

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

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

Ve style color:green;height:100px; ile div seçmek ve değiştirmek istediğiniz denedim color:blue; height:10px;

diyelim

ve

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

ama hayır şans

+0

Benim için çalışmayı denediğinizi söylediniz https://jsfiddle.net/j08691/c3kL3pd6/ – j08691

cevap

2

ile Şunları kullanabilirsiniz yaban kartları:

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

Sadece yanlışlıkla diğer unsurları alamadım emin olun.

+0

Garip. Jsfiddle'da harika çalışıyor ama projemde değil :( – Gnesh