### checkboxjs

`0.1.1`
Need help reading this?

### Checkbox

Checkbox.js aims to create a functional checkbox out of pretty much any HTML markup. This allows you to style the checkbox any way you would like. It gives you full control of the markup.

## Getting started

Given our HTML:

    <label for="checkbox">Subscribe?</label>
    <span id="checkbox"></span>

We can create a new checkbox out of a span by passing the element to checkbox.js:

    new Checkbox(document.getElementById('checkbox'));

This will create a checkbox out of that HTMLElement that you passed. Checkbox.js will try to find a `label` element in the DOM to associate with the checkbox. If it can't find a `label` it will throw an error. All checkboxes must have a label.

What your checkbox should look like after using checkbox.js:

    <label for="checkbox" id="jsze4iuu8c">Subscribe?</label>
    <span id="checkbox" tabindex="0" role="checkbox"
      aria-labelledby="jsze4iuu8c" aria-checked="false"></span>

Now you can style the checkbox to look how ever you want!

new Checkbox(checkboxEl: HTMLElement, options: Object)
Parameters
checkboxEl `(HTMLElement)`
options `(Object = `{}`)`
Instance Members
▸ checkbox

A reference to the checkbox HTMLElement in the DOM.

checkbox
▸ label

A reference to the label HTMLElement in the DOM.

label
▸ isNested

Determine if the checkbox is nested inside of a label.

isNested
Returns
`Boolean`:
▸ isChecked

Is the checkbox checked or not.

isChecked
▸ toggleCheckbox()

Toggle the current state of the checkbox.

toggleCheckbox(): Boolean
Returns
`Boolean`: isChecked - the new state of the checkbox