Tips for Enabling/Disabling ASP.NET Checkbox using Javascript

When we use a ASP.NET checkbox and by default keep it disabled. If you see the view we will notice as seen below

<
span disabled='disabled'
>
<
input type='checkbox' disabled='disabled'
>

Now if we say document.getElementById("chktest").disabled = false; . This will not work.

The workaround is

document.getElementById("chktest").disabled = false;
document.getElementById("chktest").parentNode.disabled = false;


Cheers!!!

Comments

Popular posts from this blog

“Unable to retrieve the metadata for …” Error while using ASP.NET MVC 3

Building application using ASP.NET MVC and MongoDB

Visual Studio 2013 and .NET 4.5.1