I need to know how to disable a button when the selected index of a drop down list has changed. I want to do it in javascript because i don’t want to cause a postback.
Thanks.
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.
Add this JavaScript function (it assumes your button has a
my-buttonid):In order to respond of the change of the selected index, add this onchange event to the dropdown:
onchange="disableButton()"Edit: For more information about the disabled property go to w3schools, they have lots of information about JavaScript and the HTML DOM.