jquery loop hover button
- by john morris
ok i have 6 buttons, im trying to have a jquery listener for when you hover over one of the 6 buttons, it changes class. im using a for loop to do this, heres my code:
$(document).ready(function() {
for($i=1;$i<7;$i++) {
$('#button'+i).hover(function() {
$(this).addClass('hovering');
}, function() {
$(this).removeClass('normal');
});
}
});
each button has an id of "buttonx" ( the x being a number )
help?