I have multiple buttons that I use when people answer a question. How would I get the buttons to change colors when a person clicks on the button? I do not know jquery, I have b
$('input[type="submit"]').click(function(){
$(this).css('color','red');
});
Use class, Demo:- http://jsfiddle.net/BX6Df/
$('input[type="submit"]').click(function(){
$(this).addClass('red');
});
if you want to toggle the color each click, you can try this:- http://jsfiddle.net/SMNks/
$('input[type="submit"]').click(function(){
$(this).toggleClass('red');
});
.red
{
background-color:red;
}
Updated answer for your comment.
http://jsfiddle.net/H2Xhw/
$('input[type="submit"]').click(function(){
$('input[type="submit"].red').removeClass('red')
$(this).addClass('red');
});