I have the following HTML :
<div class="wrap">
div class="red" id="ch1">Content</div>
...
<div class="green" id="ch..">Content</div>
<div class="red" id="ch..">Content</div>
</div>
<div class="wrap">
div class="green" id="ch11">Content</div>
<div class="red" id="ch12">Content</div>
...
<div class="green" id="ch..">Content</div>
</div>
and I am using the following script to change class on divs:
$(".red , .green").click(function(){
$(".green").not($(this)).removeClass("green").addClass("red");
$(this).toggleClass('red green');
});
I would like to have or all "red" or just ONE "green" div in EACH "wrap" without cancelling (convert to red) all Divs to all "wraps"