Stewie Griffin
Stewie Griffin

Reputation: 9317

jquery Mobile: check if checkbox is checked or not

How to check if checkbox is selected or not in jMobile using js?

<input class="custom" id="myCheckbox" name="myCheckbox" type="checkbox"/>

Upvotes: 7

Views: 7084

Answers (2)

MarcosOrdieres
MarcosOrdieres

Reputation: 1

If it is checked you can use

if( $("#myCheckbox").is(':checked'));

And if it is NOT checked you can use

if( $("#myCheckbox").not(':checked'));

Upvotes: 0

Luc Laverdure
Luc Laverdure

Reputation: 1470

In Short:

$("#myCheckbox").is(":checked")

Upvotes: 22

Related Questions