开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜