I have a set of buttons. I want that when I do mouse up on one of the buttons, that particular button will change its back colour while all the other will remain the same.
Any help on how to do it without having any post back.?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Here’s a fairly clunky way to do it:
Demo: http://jsfiddle.net/Yn3pT/
This assumes the buttons are children of a form called “someForm” and that a class “selected” exists that has the appropriate colour – obviously you’ll modify this as appropriate to suit your markup.
Note that the above should either be in an onload handler or the script block should be somewhere after the elements in the source.
Note also that
onclickwould be much more appropriate thanonmouseupfor this.