Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Web and WebWorks Development

Reply
New Developer
carillonator
Posts: 2
Registered: ‎01-21-2010
My Device: emulator
My Carrier: none
Accepted Solution

[un]checking HTML checkbox with attribute

[ Edited ]

I am trying to check and uncheck an <input type="checkbox" /> by adding and removing the checked="checked" attribute using javascript (jQuery).  Doesn't work; nothing happens. It does work fine in desktop browsers, though.  Adding and removing disabled="disabled" works perfectly.  I've seen other posts about this on the internet, but no answers. 

 

I'm writing in XHTML 1.0 Strict, hence the checked="checked", but I tried switching everything around to HTML 4.1 and just using checked with no equals sign or value, and it still didn't work. 

 

I'm working on Eclipse with the BlackBerry Simulator 4.6.0.200904091609-212.

 

Any ideas? Thanks.

Please use plain text.
Developer
Posts: 107
Registered: ‎09-25-2008
My Device: Not Specified

Re: [un]checking HTML checkbox with attribute

Have you tried setting "mycheckboxelement.checked = true"? For form input elements there's a difference between the default value (which is what you're modifying with the HTML attribute checked) and the live DOM value (which is what you're modifying with .checked).

Please use plain text.
New Developer
carillonator
Posts: 2
Registered: ‎01-21-2010
My Device: emulator
My Carrier: none

Re: [un]checking HTML checkbox with attribute

It works, but I had to do it this way:

 

document.myform.thecheckbox.checked = false;

 

thanks!

 

Please use plain text.