Coder Social home page Coder Social logo

jquery-checkbox-casecade's Introduction

jquery-checkbox-casecade

input:checkbox casecade --- jquery plug-in

what is it ?

jquery-checkbox-casecade is a jqery plug-in that helps html developers control input:checkbox act well . Selecting all input means we should traversal all the checkboxs and use jquery to make all them seleced,eg... AKA,doing this in your codes is very troublesome , which would make your codes ugly . Then jquery-checkbox-casecade should do all this for you .

how to use it

###1 include jquery-checkbox-casecade.js in your html file .

Please make sure you have included jquery before this.

<script type="text/javascript" src="jquery.min.js"></script>
<script type="text/javascript" src="jquery-checkbox-casecade.js"></script>

###2 add an spacial attribute data-id data-parent in html input:checkbox tag

<div id="checkboxContent1">
	<label>
		<input type="checkbox" name="name1" data-id="p0" data-parent="-1"/>all-0</label>
	<label>
		<input type="checkbox" name="name1" data-id="p1" data-parent="0"/>reverse-select</label>
	<br>
	<label>
		<input type="checkbox" name="name1" data-id="p10" data-parent="p0"/>p0-10</label>
	<label>
		<input type="checkbox" name="name1" data-id="p11" data-parent="p0"/>p0-11</label>
	<br>
	<label>
		<input type="checkbox" name="name1" data-id="p20" data-parent="p10"/>p10-20</label>
	<label>
		<input type="checkbox" name="name1" data-id="p21" data-parent="p10"/>p10-21</label>
</div>

Every input:checkbox has data-id and data-parent attr;data-id means its own ID----only one;data-parent means its parent's ID.Whit the two attrs, you can find every checkbox in the tree.

data-parent="-1" means it is the root selection. data-parent="0" means it is reverse selecttion

###3 do action !

	<script type="text/javascript">	
		$(function () {
			$('#checkboxContent1').casecade();
		})
	</script>

use jquery-checkbox-casecade plug-in just code $('#checkboxContent1').casecade(); . #checkboxContent1 is input:checkbox's parent DOM. If you code does not has this Dom Structure ,use bodyinstead .

To see more ,you can download and see the example file .

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.