Uncheck all checkboxes when a page loads using jquery

I am working on a project at the moment that requires checkboxes to do animations using jquery. It's all working fine unless I return to the page using the back button. As a work around I decided it would be best to just clear out any checkbox that were already selected. It's not ideal, but it saves me having to fire off an animation on page load which looks very slow as everything else on the page is loading in.

To uncheck all of the checkboxes on your page using jquery all you need to do is use this code:

$().ready(function() {
    //on page load uncheck any ticked checkboxes
    $("input:checkbox:checked").attr("checked", "");
});

blog comments powered by Disqus

Get In Touch

Follow me online at TwitterFacebook or Flickr.

Latest Tweets