codetoad.com
  ASP Shopping CartForum & BBS
  - all for $20 from CodeToad Plus!
  
  Home || ASP | ASP.Net | C++/C# | DHTML | HTML | Java | Javascript | Perl | VB | XML || CodeToad Plus! || Forums || RAM 
Search Site:
Search Forums:
  Enabling/Disabling Checkbox with js  ninel at 18:23 on Tuesday, April 18, 2006
 

I have a checkbox that I set as enabled="false".
I then kick off a javascript function that should enable it.

I have the following code:
[code]
<asp:checkbox id="chkRead" runat="server" Font-Names="Tahoma" Font-Size="x-Small" enabled="False" ></asp:checkbox>

function toggleInputElementsDisabledStatus()
{
if (document.all || document.getElementById)
{
alert(document.getElementById("chkRead").disabled); document.getElementById("chkRead").disabled=false;
alert(document.getElementById("chkRead").disabled);
}
}
[/code]

As you can see I have alert messages telling me what the disable value of the checkbox is.
The first alert shows me that disable is true. The second shows me that disable is false. So the checkbox should get enabled on the aspx page, but it doesn't. It stays disabled.

When I look at the view source of the aspx page I see <span> tags around the checkbox.
[code
<span disabled="disabled" style="font-family:Tahoma;font-size:X-Small;"><input id="chkRead" type="checkbox" name="chkRead" disabled="disabled" /></span>
[/code]

Could this span tag be the culprit? How do I get around this?

Any help would greatly be appreciated.
Thanks,
Ninel








CodeToad Experts

Can't find the answer?
Our Site experts are answering questions for free in the CodeToad forums








Recent Forum Threads
•  Making a simple game
•  Re: Conversion
•  disable radio button
•  problem with recurssion
•  session values
•  Re: array names
•  how to call java script function in input tag ,that java script function written in another javascript file
•  Re: button color
•  Access denied error when submit form


Recent Articles
What is a pointer in C?
Multiple submit buttons with form validation
Understanding Hibernate ORM for Java/J2EE
HTTP screen-scraping and caching
a javascript calculator
A simple way to JTable
Java Native Interface (JNI)
Parsing Dynamic Layouts
MagicGrid
Caching With ASP.Net


© Copyright codetoad.com 2001-2006