Skip to content

How to check if a JQuery Mobile checkbox is checked

June 7, 2013

To check using JQuery if a checkbox is actually checked or not, you can write the following code with ID checkbox-1, then throw up an error pop up box.

if (!$(‘input:checkbox#checkbox-1’).is(‘:checked’))
{          
    $(“#popupCheckBox”).popup( “open”, {transition: “fade”} );
    return;        
}

It essentially checks if the checked variable is set to checked. You can also default this inside the checkbox itself by writing checked=”checked”.

Advertisements

From → Uncategorized

Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: