🔔 Alert..!! Get 2 Month Free Cloud Hosting With $200 Bonus From Digital Ocean ACTIVATE DEAL

triSwitch is a tri-state checkbox jQuery plugin that allows the checkbox to have three check states rather than two.

Checkbox Tri-state-Checkbox

Documentation

jquery.triSwitch

NuGet license

A simple checkbox with three states made with love.

FOSSA Status

Documentation & demo

For code sample check out the index.html file or go to the live demo.

Available on NuGet Gallery : here

Minimal browser compatibility

Web browser Version
Chrome Ok
Firefox v3.5
IE v9
Opera v10
Safari v4

Dependencies

jQuery v1.11.3 at least. Works perfectly on higher versions.

Features

  • Override jQuery val() to get/set the current value.
  • Trigger "change" event.
  • Allow you to define your own awesome style.

Usage

	<!-- reference both css and js files -->     <link href="css/jquery.triSwitch.css" rel="stylesheet">     <script src="js/jquery.triSwitch.js"></script>  	<!-- Add a checkbox to your page --> 	<input type="checkbox" id="my_checkbox" />
	// Initialize the plugin 	$("#my_checkbox").triSwitch();
	// Using options 	$("#my_checkbox").triSwitch({  		type: "normal",  		defaultValue:  1  	});
	// Binding change event notification 	$("#my_checkbox").on("change", function () { 		alert($(this).val()); 	});
	// Disable change notification with style 	$("#my_checkbox").attr("disabled", true);

Options

Name Type Default Description
type string normal Define the state cycle. "normal": uncheck > both > check / "any_thing_else": uncheck > check
defaultValue number -1 Sets the initial state. -1: unchecked / 0: both / 1: checked

Callback events

Event Description
change Triggered each time the user click on a checkbox

##License

MIT License

Copyright (c) 2014-2016 ApiO

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.


You May Also Like