Custom Checkbox Into iOS-style Switch | customcheckbox

A custom checkbox HTML, CSS, jquery, and iPhone style button to activate or deactivate the checkbox. We keep an input check box so we can submit it via forms.

The custom checkbox is a very small jQuery snippet that turns checkboxes into iOS-style toggle buttons while preserving the original selection functions and deselecting the functions.

Read More – Switch Text With Smooth Animations | jQuery Animated Headlines

How to make use of it:

1. Add the next HTML next to the checkbox input.

<input type="checkbox" name="switch" />
<div class="customcheck">
  <div class="checkitem"></div>

2. Hide the original checkbox.


3. Customize the looks of the swap control.

.customcheck {
  width: 80px;
  height: 20px;
  border: 3px solid #BDBDBD;
  border-radius: 20px;
  background: #d8d8d8;

4. Customize the looks of the thumb.

/* styles when inactive */
.checkitem {
  width: 14px;
  height: 14px;
  border-radius: 16px;
  border: 2px solid #484848;
  background-color: #696969;
  margin: 1px;
  margin-left: 2px;
  transition: all 0.5s ease;

/* styles when active */
  margin-left: 60px;
  border: 2px solid #0ebd0e;
  background-color: #24da24;

4. Include the newest jQuery library.

<script src="/path/to/cdn/jquery.slim.min.js"></script>

5. The jQuery script to activate the swap control.

  var item = $(".checkitem");
  if (item.hasClass("itemactive")){
    // It is activated. Deactivate it!
    $(".customcheck").css("background-color", "#d8d8d8")
    $("input[name='switch']").prop("checked", false);
  } else {
    // It's deactivated. Activate it!
    $(".customcheck").css("background-color", "#befbbe")
    $("input[name='switch']").prop("checked", true);

Convert Checkbox Into iOS-style Switch, customcheckbox Plugin/Github, jquery switch button


A Tiny JavaScript Library to Easily Switch any HTML Element | Easy Toggle State
JQuery Toggle Switch Plug-in for Tailwind CSS

See Demo And Download

Official Website(crisego): Click Here

This superior jQuery/javascript plugin is developed by crisego. For extra Advanced Usage, please go to the official website.