78
rated 0 times
[
83]
[
5]
/ answers: 1 / hits: 95450
/ 9 Years ago, tue, april 21, 2015, 12:00:00
How do I check if a textbox is disabled or enabled in JavaScript? I just want to know if a textbox is enable or disabled on button click. If the textbox is disabled I want to alert the user with the message disabled and if it is enable, the alert message will be enabled.
<script>
function CheckTextbox(){
if(textbox1 is disabled){ //here
alert(disabled);
}else{
alert(enable);
}
if(textbox2 is disabled){ //here
alert(disabled);
}else{
alert(enable);
}
}
</script>
<input type=text id=textbox1 disabled=disabled>
<input type=text id=textbox2>
<input type=button onclick=CheckTextbox();>
More From » javascript