I am new to Jquery so please pardon me if I am asking a simple question but I need some help.
In my HTML markup, I have 3 divisions with id from test1 to test3 and a button.
<input type="button" id="button_click" value="ok" />
<div class="supercolor" style="width:100px;">
<div class="colordiv" id="test1" > </div>
<div class="colordiv" id="test2" > </div>
<div class="colordiv" id="test3"> </div>
</div>
What I want to do is on button click, I want to iterate through all divs in the 'supercolor' class to change the div's css background to red.
Code I have now
$('#button_click').click(function(){
$('div.supercolor').each(function() {
$(this).css("background-color","red");
});
});