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


Thank you for visiting the BlackBerry Support Community Forums.

BlackBerry will be closing the BlackBerry Support Community Forums Device Forums on April 1st (Developers, see below)

BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.

"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."

- Kevin Michaluk, Founder, CrackBerry.com

Developers, for more information about the BlackBerry Developer Community please review Join the Conversation on the BlackBerry Developer Community Forums found on Inside BlackBerry.


Reply
Developer
Posts: 676
Registered: ‎05-06-2012
My Device: Dev Alpha & PlayBook
My Carrier: wifi
Accepted Solution

JQMobile - uncheck with Javascript

I've made a JQMobile checkbox like so...

 

<label><input type="checkbox" name="checkbox" id="checkbox"/> Label</label>

 

I want to use Javascript to uncheck the box. 

 

I've tried the script normally used for unchecking checkboxes with jquery

 

$('input[name=checkbox]').attr('checked'false);

 

I've also tried using a piece of code I found on the jQuery Mobile website ( http://jquerymobile.com/test/docs/forms/checkboxes/methods.html )

 

$("input[type='checkbox']").checkboxradio('disable');

Neither methods seem to work.

_________________________________________________________
co-founder of Diaree | BB Dev for PictureThis
Contributor
Posts: 33
Registered: ‎04-30-2012
My Device: PlayBook, DevAlpha
My Carrier: 3AT

Re: JQMobile - uncheck with Javascript

You have to refresh every UI component in jQueryMobile if you change its state via JavaScript. In this case the code should look like this:

$("input[type='checkbox']").attr("checked",false).checkboxradio("refresh");

 

Developer
Posts: 676
Registered: ‎05-06-2012
My Device: Dev Alpha & PlayBook
My Carrier: wifi

Re: JQMobile - uncheck with Javascript

Went to http://blackberry.github.com/jQueryMobile-BB10-Theme/kitchenSink/checkboxes.html

Turned on Ripple Emulator. Checked a box. Then opened the Javascript console and pasted your suggested code.

It returns ...

TypeError: Object [object Object] has no method 'checkboxradio'
_________________________________________________________
co-founder of Diaree | BB Dev for PictureThis
Highlighted
Developer
Posts: 676
Registered: ‎05-06-2012
My Device: Dev Alpha & PlayBook
My Carrier: wifi

Re: JQMobile - uncheck with Javascript

It seems the problem is actually something to do with the Ripple Emulator.

https://github.com/blackberry/jQueryMobile-BB10-Theme/issues/76#issuecomment-11537132
_________________________________________________________
co-founder of Diaree | BB Dev for PictureThis