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 .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.