jQuery Plugin To Persist Checkbox State Using Local Storage

jQuery Plugin To Persist Checkbox State Using Local Storage
File Size: 5.38 KB
Views Total:
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   

Persistent Checkboxes is a dead simple jQuery plugin that temporarily stores checkbox states in local storage using HTML5 Web Storage API and restore them when needed (refresh the web).

How to use it:

1. Load the Persistent Checkboxes plugin's JavaScript file after jQuery library and we're ready to go.

<script src="//code.jquery.com/jquery-3.1.1.slim.min.js"></script>
<script src="persistent-checkboxes.js"></script>

2. Add unique IDs to your existing checkboxes and we're done. The plugin will load any saved check boxes and place a listener on checkbox changes, saving the status of every checkbox as it changes.

<input type="checkbox" id="checkbox-1" checked>
<input type="checkbox" id="checkbox-2">

This awesome jQuery plugin is developed by hafeild. For more Advanced Usages, please check the demo page or visit the official website.