JQuery is a great framework and a great help bringing some eye-candy and interface richness into our webapps.
Like me, most of the web developers don’t have the chance of learning JQuery from the top to the bottom, and all that’s left is a step-by-step approach, where the learning comes from specific needs on the current project.
Let’s see how we can check, uncheck and see the checkbox state with jquery.
Let’s think of this checkbox :
<input id="mycheck" type="checkbox" />
To see the state of the checkbox all you have to do is
var checked=$("#mycheck").attr("checked");
To check the checkbox all you have to do is
$("#mycheck").attr("checked",true);
And to uncheck the it all you have to do is
$("#mycheck").attr("checked",false);
for JQueryMobile we need to add an extra step
$(‘input:checkbox’).checkboxradio(‘refresh’);
Mayooresan,
Thank you so much!
It took me forever to try to figure this out.
Once again Thanks!
Mayooresan
merci infiniment, tu me sauve la vie
Thanks buddy – Mayooresan.
I was trying for hours to do that. your comment helped out.