Skip to content

benignware/jquery-checkview

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

56 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

jquery-checkview

This jQuery plugin enables custom css styling of checkboxes and radiobuttons.

Features

  • Custom css styling
  • Keyboard and Tab control

Demo

Usage

Include dependencies

<script src="http://code.jquery.com/jquery-1.11.2.min.js"></script>
<script src="jquery.checkview.min.js"></script>

Provide markup

<label><input type="checkbox"/> Check me!</label>

Init checkview as follows:

$("input[type='checkbox'], input[type='radio']").checkview();

Set up your css. Take a look at the example styles:

.checkview {
  background-color: #FFFFFF;
  border: 1px solid #ACACAC;
  line-height: 1em;
}

.checkview .icon-ok {
  display: inline-block;
  background: url('http://cdn.dustball.com/tick.png') no-repeat center;
  background-size: contain;
  width: 1em;
  height: 1em;
}

Bootstrap Example

Include Bootstrap CSS:

<link href="http://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet"/>

Provide Bootstrap Checkbox Markup:

<div class="checkbox">
  <label>
    <input type="checkbox"> Check me!
  </label>
</div>

Configure checkview with Bootstrap's button and icon components:

$(".checkbox input[type='checkbox']").checkview({
  wrapperClass: 'btn btn-default btn-xs',
  iconClass: 'glyphicon glyphicon-ok'
});

Options

NameDescriptionDefault
checkedClassCSS Class to indicate the checkview's statecheckview
iconClassIcon css classicon-ok
preventSubmitSpecifies whether to propagate pressing of enter keyfalse
wrapperClassContainer css classcheckview
wrapperTagContainer tag namespan

Methods

NameDescriptionReturn
getCheckedReturns the checkview's stateboolean
invalidateRefreshes the componentvoid
setChecked(bool)Sets the checkview's statevoid

Method example

Access plugin-instance and refresh

$("#checkview").data('checkview').refresh();

About

This jQuery plugin enables custom css styling of checkboxes and radiobuttons.

Resources

License

Stars

Watchers

Forks

Packages

No packages published