Installation
Download the full package from
github and install
locally by adding the script into the head section of your project file.
<script src="checkbox/checkBox.js">
You can also install using the CDN Link below
https://cdn.jsdelivr.net/gh/teymzz/checkBox/checkBox.js
Image resources are not available through the cdn link. Download the full
plugin to get the resources or use your preferred custom images.
Plugin Setup
Before initializing the plugin, we need to setup the html structure correctly.
This can be done by defining a custom checkbox element
followed by its relative native checkbox. This is shown below:
<div checkbox=""></div> <!-- custom checkbox -->
<input type="checkbox"> <!-- native checkbox -->
Now, we can initialize the plugin using any of the methods below:
<script>
new CheckBox(); // new instance
</script>
<script>
let checker = new CheckBox(false); // defer instantiation
let checker1 = checker.check(); //new instance
let checker2 = checker.check(); //new instance
</script>
Once initialized, the plugin will automatically hide all native input checkboxes having a custom checkbox controller element on the web page
while the custom checkboxes will be displayed.