Git Product home page Git Product logo

checkboxes's Introduction

checkboxes is a jQuery plugin for custom radios and checkboxes.

I wrote this tired of having to call update methods with existing input beautifier tools.

Besides autoupdating, the inputs will still trigger any "change" or "click" bindings you have placed on them.

checkboxes does not honor any other events besides "click" and "change", nor does it 

// =========
// = USAGE =
// =========

$(selector).checkboxes();

After initialization, if you want to check one or more checkboxes, then do:

$(selector).checkboxes("check",true);

Giving false as the second argument will uncheck the checkboxes, and giving no second argument toggle the checks.

// ===========
// = Example =
// ===========

The following:

<input id="radio_1" type="radio" name="radio_group"/>
<label for="radio_1">Radio 1</label>

<input id="radio_2" type="radio" name="radio_group"/>
<label for="radio_2">Radio 2</label>

<input id="checkbox_1" type="checkbox" name="options[]"/>
<label for="checkbox_1">Checkbox 1</label>

<script type="text/javascript" charset="utf-8">
  $("input[type=checkbox],input[type=radio]").checkboxes()
</script>

Will yield the following markup:

<span class="radio">
  <input id="radio_1" type="radio" name="radio_group"/>
</span>
<label for="radio_1">Radio 1</label>

<span class="radio">
  <input id="radio_2" type="radio" name="radio_group"/>
</span>
<label for="radio_2">Radio 2</label>

<span class="checkbox">
  <input id="checkbox_1" type="checkbox" name="options[]"/>
</span>
<label for="checkbox_1">Checkbox 1</label>

checkboxes's People

Contributors

humanrender avatar

Stargazers

Nelly Natalí avatar  avatar

Watchers

 avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.