enable a textbox on the selection of no from the drop down menu
I 开发者_JAVA百科have a drop down menu where i have three options yes no and later.And when i select no option then the textbox must enable which was previously disable.so help me with some javascript script and explain me how can i call the script from the form.
Use the onchange
event and check for the value of the option elements, something like this:
mySelect.onchange = function () {
document.getElementById("myTextArea").disabled = this.value != "No";
}
Working example: http://jsfiddle.net/zJ97A/
Here you go : http://jsfiddle.net/neebz/LcfN5/
However I would strongly suggest you use a framework like jQuery or something for cross-browser compatibility.
精彩评论