I am setting my jquery mobile checkboxes like so..
$("#checkbox-2a").attr("checked", settings.DEnabled).checkboxradio("refresh");
Here is the markup
<fieldset data-role="controlgroup" data-mini="true" style="text-align:center;">
<input type="checkbox" name="checkbox-2a" id="checkbox-2a" class="custom" />
<label for="checkbox-2a">
Enable D</label>
..
The checkboxes get checked correctly. But now when I want to retrieve a value with this code..
settings.DEnabled = $("#checkbox-2a").attr("checked");
When I debug it returns 'checked', when I look at the markup eventhough the checkboxes are getting updated when the correct check bool in the ui. I dont see a 'checked' attribute in the markup.
How do I get/find the value of the checkbox?
attr
doesn't return a boolean value, you can use prop
method: http://api.jquery.com/prop/#entry-examples
settings.DEnabled = $("#checkbox-2a").prop("checked");
Or is
method:
settings.DEnabled = $("#checkbox-2a").is(":checked");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With