Coder Social home page Coder Social logo

jquery.selecttodo.js's Introduction

jquery.selectToDo.js

实现多个Checkbox全选,反选,取消选择功能的JQuery插件

演示地址

使用说明

<script src="http://code.jquery.com/jquery-1.11.0.min.js"></script>
<script src="jquery.selectToDo.js" type="text/javascript" charset="utf-8"></script>
<input type="checkbox" value="1" name="check">
<input type="checkbox" value="2" name="check">
<input type="checkbox" value="3" name="check">
<input type="checkbox" value="4" name="check">
<input type="checkbox" value="5" name="check">

<input type="button" value="Select All" id="selectAll">
<input type="button" value="Select None" id="selectNone">
<input type="button" value="Select Invert" id="selectInv">
<input type="button" value="Do something" id="actionButton">
$(function(){
	var selectToDo = $("input[name='check']").selectToDo();
	$("#actionButton").bind("click",function(){
		alert(selectToDo.result());
	});
});

参数

$("input[name='check']").selectToDo({
	"selectAllButton"    : $("#selectAll"),    //全选按钮
	"selectNoneButton"   : $("#selectNone"),   //取消选择按钮
	"selectInvertButton" : $("#selectInv")     //反选按钮
});

方法

var selectToDo = $("input[name='check']").selectToDo();
selectToDo.result();         //返回选中的值组成的字符串,例如:1,2,3,4,5
selectToDo.selectAll();      //全选
selectToDo.selectNone();     //取消选择
selectToDo.selectInvert();   //反选

License

Licensed under the MIT License.

jquery.selecttodo.js's People

Contributors

elrichuang avatar

Watchers

 avatar

Forkers

deawx

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.