I need to remove the class ‘twist’ from image inside li that has class ‘selected’ using jquery
<ul class="gal">
<li>
<img class="twist" src"..." />
</li>
<li class="selected">
<img class="twist" src"..." />
</li>
<li>
<img class="twist" src"..." />
</li>
<ul>
Somebody please help.
Thanks
demo http://jsfiddle.net/kmhdj/2/
Demo will alert the before and after class attribute.
You can also do
.eachiteration if you are expecting different classes and different outcome.There is also an API called
.hasClass()which you can use when you iterate to check if that class exist but all this is extra info.Hope this helps
Another demo==> Here is a long cut way using
.each&.hasClassin case you keen: http://jsfiddle.net/kmhdj/5/code