Answer the question
In order to leave comments, you need to log in
How to change div classes?
How can I change the class of a div through one div.
Example:
<div id="test">
<div id="id1" class="1"></div>
<div id="bla-bla" class="propusk"></div>
<div id="id1" class="2"></div>
<div id="id1" class="1"></div>
<div id="bla-bla" class="propusk"></div>
<div id="id1" class="2"></div>
</div>
$('#id1:even').addClass('left');
$('#id1:odd').addClass('right');
Answer the question
In order to leave comments, you need to log in
Your code and the enemy will not wish.
$("#test > div").not(".propusk").each(function(i){
$(this).addClass(i%2 ? "right" : "left");
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question