jQuery Uniform Checkbox does not (un)check
SIMPLE SOLUTION
This is because UniformJs
requires that you update your modification on uniform elements if you need to change values on the form dynamically:
$('#checkbox').prop('checked',true);$.uniform.update();
Edit
If you wish to update the #checkbox
only:
$('#checkbox').prop('checked',true);$.uniform.update('#checkbox');
I know this may be a bit late, but hopefully it will help someone. I had to add a couple lines to the uniform code so it would look for pre checked checkboxes. This code starts at line 262 for me. I am using Uniform version 1.7.5. The lines between the 'added by John' notes are what I added.
"click.uniform touchend.uniform": function(){ if(!$(elem).attr("checked")){ //box was just unchecked, uncheck span spanTag.removeClass(options.checkedClass); // Added by John to look for checkboxes with the attr "checked" that have been click to uncheck }else if(!$(elem).is(':checked')){ spanTag.removeClass(options.checkedClass); // end addition by john }else{ //box was just checked, check span. spanTag.addClass(options.checkedClass); } },