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.
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.
Add this JavaScript function (it assumes your button has a my-button
id):
function disableButton()
{
button = document.getElementById("my-button");
button.disabled = true;
}
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.