Reputation: 15940
I have come across a requirement to disable the drop down items through the following javascript code.
function alertselected(selectobj){
alert(selectobj.selectedIndex)
if(selectobj.selectedIndex ==1){
alert('15656');
document.getElementById("reportFlag").disabled=true;
}else{
document.getElementById("reportFlag").disabled=false;
}
}
Can any one suggest how do i implement this feature without using the disable feature.
http://www.w3schools.com/TAGS/att_option_disabled.asp Above link says that disable attribute is not supported in IE.
Please help me other equivalent approach for the same
Upvotes: 1
Views: 188
Reputation: 499062
The disabled
attribute is defined on the input
element in the HTML 4.01 spec as follows:
When set for a form control, this boolean attribute disables the control for user input.
It is also defined on the option
element.
I would not use w3schools as an authoritative source of information - they are not affiliated with w3 (despite the name) and have many inaccuracies (which they don't fix, even when asked) - see http://w3fools.com
Upvotes: 1