Page 1 of 1

Check if checkbox is checked

Posted: Thu May 31, 2012 2:54 pm
by larp.ly

I need to see if a checkbox is checked.
I have tried a few different ways but am not sure with using the Tiggr API.

Right now I have

var dblRare = Tiggr('dblRare');
if ($('#dblRare').attr('checked'))
{alert("checked");}

Can spomeone please provide some insight on the syntax for this?


Check if checkbox is checked

Posted: Thu May 31, 2012 4:44 pm
by maxkatz

It should be something like this:
code
var v = $("input[type='checkbox']:first").attr("checked");
alert (v);
/code

As per: http://jquerymobile.com/demos/1.1.0/d...


Check if checkbox is checked

Posted: Thu May 31, 2012 6:11 pm
by larp.ly

Thanks for the quick reply.

I have this now:

var v =$("input#dblRare").attr("checked");
alert (v);

dblRare is part of a mobileCheckBoxGroup1

Would i need to something like
$(input#mobileCheckBoxGroup1.dblRare".attr("checked")

to access it. Even the documentation for jquery doesnt reall seem to cover this,
There are a few different boxes that I need to check for the group.

Thanks again.


Check if checkbox is checked

Posted: Thu May 31, 2012 7:42 pm
by maxkatz

Try selecting each individual input (check box) and checking its state.