jQuery plugin for styling checkboxes and radio-buttons

Overview

ion.checkRadio

English description | Описание на русском

jQuery-plugin for styling checkboxes and radio-buttons. With skin support.


Description

  • Ion.CheckRadio — nice and easy jQuery-plugin for checkbox and radio-buttons customization.
  • With skin support
  • Crossbrowser: Google Chrome, Mozilla Firefox, Opera, Safari, IE(8.0+)
  • Ion.CheckRadio supports touch-devices (iPhone, iPad, etc.).
  • Ion.CheckRadio freely distributed under terms of MIT licence.

Demo Page

Dependencies

Using script

Import this libraries:

  • jQuery
  • ion.checkRadio.min.js

And CSS:

  • normalize.min.css - desirable if you have not yet connected one
  • ion.checkRadio.css
  • ion.checkRadio.skinName.css

Don't forget about skin image:

  • icr-skinName-skin.png - skin sprite
  • Or use included PSD file and draw your own skin

Install with bower

  • bower install ion-checkradio

Install with npm

  • npm install ion-checkradio

Install with spm

  • spm install ion-checkradio

Recommended HTML

Radio-buttons:

<label class="icr-label">
    <span class="icr-item type_radio"></span>
    <span class="icr-hidden"><input class="icr-input" type="radio" name="!group_name!" value="!radio_value_1!" /></span>
    <span class="icr-text">!radio_text_1!</span>
</label>
<label class="icr-label">
    <span class="icr-item type_radio"></span>
    <span class="icr-hidden"><input class="icr-input" type="radio" name="!group_name!" value="!radio_value_2!" /></span>
    <span class="icr-text">!radio_text_2!</span>
</label>

Checkboxes:
<label class="icr-label">
    <span class="icr-item type_checkbox"></span>
    <span class="icr-hidden"><input class="icr-input" type="radio" name="!group_name!" value="!checkbox_value_1!" /></span>
    <span class="icr-text">!checkbox_text_1!</span>
</label>
<label class="icr-label">
    <span class="icr-item type_checkbox"></span>
    <span class="icr-hidden"><input class="icr-input" type="radio" name="!group_name!" value="!checkbox_value_2!" /></span>
    <span class="icr-text">!checkbox_text_1!</span>
</label>

Regular HTML

Create checkboxes and/or radio-buttons:

<input type="radio" name="reading" value="0" id="reading_0" /> <label for="reading_0">Very much</label>
<input type="radio" name="reading" value="1" id="reading_1" /> <label for="reading_1">Sometimes</label>
<input type="radio" name="reading" value="2" id="reading_2" /> <label for="reading_2">Better watch movie</label>
<input type="radio" name="reading" value="3" id="reading_3" /> <label for="reading_3">Hate it</label>

or

<label><input type="radio" name="movies" value="0" /> Love them</label>
<label><input type="radio" name="movies" value="1" /> Like them</label>
<label><input type="radio" name="movies" value="2" /> Indifferent</label>
<label><input type="radio" name="movies" value="3" /> Hate them</label>

or drop some checkboxes:

<label><input type="checkbox" name="think" value="0" /> Self</label>
<label><input type="checkbox" name="think" value="1" /> Money</label>
<label><input type="checkbox" name="think" value="2" /> Stuff</label>
<label><input type="checkbox" name="think" value="3" /> Health</label>
<label><input type="checkbox" name="think" value="4" /> Work</label>
<label><input type="checkbox" name="think" value="5" checked /> Rest</label>
<label><input type="checkbox" name="think" value="6" disabled checked /> Sex</label>

Initialize slider

// all on the page:
$("input[type='radio'], input[type='checkbox']").ionCheckRadio();

// or specific only:
$(".my_inputs").ionCheckRadio();

Success!

Update history


Support Ion-series plugins development:

Comments
  • Visually Its working but functional Not

    Visually Its working but functional Not

    Hi There,

    I have tried to put check box

    <ul>
     <li>
     <label><input type="checkbox" name="Overall" value="0" id="kiran" />Overall</label>
     </li>
    
     <li>
     <label><input type="checkbox" name="bussiness" value="1" id="arun" />Overall</label>
     </li>
    <.ul>
    </code>
    

    and Visually the selection is working but i checkd e the input box is $('#kiran').is(":checked") its giving false on both condition.

    opened by kirangsa 6
  • Fix .prop usage

    Fix .prop usage

    http://api.jquery.com/prop/

    Example of valid usage:

    $( "input" ).prop( "disabled", false );
    $( "input" ).prop( "checked", true );
    

    May be a reason of bug #10

    opened by Stafox 6
  • losing triggers on original input fields

    losing triggers on original input fields

    I used your plugin to prettify my radio buttons, only i found one penalty. I lost my original working of code. I Expect the code to fire on change event when i click on the radio button, but this no longer is true. instead in listens to the onchange event of the hidden radio button and acts accordingly, but not backwards. can you please fix this?

    question 
    opened by joelharkes 2
  • Select and unselect checkboxes programmatically not working with minified version

    Select and unselect checkboxes programmatically not working with minified version

    I m unable to select and unselect checkboxes programmatically with minified version of checkRadio.js. My code works fine with the original version of checkRadio.js.

    Here is my code :

    
    <script>
            $(function () {
                $("input[type='radio'], input[type='checkbox']").ionCheckRadio();
            });
    
            function subscribeAll(flag) {
                if (flag) {
                    $('.dingding input:checkbox').prop("checked", true).trigger("stateChanged");
                }
            } 
    
    </script>
    <label><input id="select-all" onchange="subscribeAll(this.checked)" type="checkbox" name="think" value="4"/> Select All</label>
    <br/><br/>
    <div class="dingding">
        <label><input type="checkbox" name="think" value="0"/> Opion</label>
        <br/>
        <label><input type="checkbox" name="think" value="3"/> Health</label>
        <br/>
    </div>
    
    
    bug 
    opened by waleed-dawood-confiz 2
  • When using name as an array

    When using name as an array

    The style of the element is not working when using the name as an array

    <input name="field[]" id="checkboxes-0" value="1" type="checkbox">

    screenshot_1

    bug 
    opened by laviku 1
  • Update ion.checkRadio.js

    Update ion.checkRadio.js

    копируем css класс от основного элемента

    при использовании tbs иногда необходимо указать класс css. например :

    <!-- было -->
    <input type="radio" value="" class="col-sm-12 col-md-12" name="myRadio">
    <!-- стало -->
    <span id="icr-3" class="icr enabled checked col-sm-12 col-md-12">
        <span class="icr__radio"></span>
        <span class="icr__text">myLable</span>
    </span>
    
    opened by iPrior 1
  • Make it compatible with Rails form builder

    Make it compatible with Rails form builder

    Make the rendered form compatible with Rails form builder, when Rails render a checkbox:

    <label id='remember-me'>
       <%= f.check_box :remember_me %>
       <%= Spree.t(:remember_me) %>
    </label>
    

    it will put a hidden input before the checkbox, like

    <label id='remember-me'>
      <input name="spree_user[remember_me]" type="hidden" value="0" />
      <input id="spree_user_remember_me" name="spree_user[remember_me]" type="checkbox" value="1" />
      Remember me
    </label>
    

    So if the user didn't check the checkbox, it will send the hidden '0' to the server. The order of the hidden and checkbox inputs must be preserved. If we call

    $input.appendTo($container);
    $label.appendTo($container);
    

    The hidden input will be after the checkbox, then when the server receives the params, the value will always be 0. So remove the line

    $input.appendTo($container);
    

    to preserve the order of these two inputs.

    opened by climber2002 1
  • Лишние события

    Лишние события

    Не вижу необходимости триггерить событие «stateChanged» у всех радиобаттонов группы — в частности у тех, у которых состояние не меняется.

    Пример. Три радиобаттона. Ни один не выбран. Я выбираю второй. В итоге событие «stateChanged» срабатывает у каждого из трёх радиобаттонов, хотя у №1 и №3 state совсем даже не changed.

    opened by eugene-lazarev 1
  • Issue with multiple checkboxes

    Issue with multiple checkboxes

    Here is a bug with multiple checkboxes.

    You can reproduce it this way, add this code to your page and init a plugin

    <label><input type="checkbox" name="multiple[]" id="first" value="1"> First</label>
    <label><input type="checkbox" name="multiple[]" id="second" value="2"> Second</label>
    <label><input type="checkbox" name="multiple[]" id="third" value="3"> Third</label>
    
    bug 
    opened by Stafox 0
  • Change

    Change "checked" value of radio group programmatically does not seem to work

    Hi, I'm looking for a way to change which element of a radio button group is checked via JS. But it doesn't seem to work. The suggested way to trigger a change event doesnt work

    http://ionden.com/a/plugins/ion.checkRadio/demo.html

    <label class="icr-label">
    <span class="icr-item type_radio"></span>
    <span class="icr-hidden"><input class="icr-input" type="radio" name="myGroupRadio" value="0" /></span>
    				    <span class="icr-text">Metric</span>
    				</label>
    				  <label class="icr-label">
    				    <span class="icr-item type_radio"></span>
    				    <span class="icr-hidden"><input class="icr-input" type="radio" name="myGroupRadio" value="1" /></span>
    				    <span class="icr-text">Imperial</span>
    				</label>
    
    <script>
      $('.icr-input').ionCheckRadio();
    </script>
    
    <script>
       //trying to set a first radio to checked via js
       $($(".icr-input")[0]).trigger("change");
    </script>
    
    opened by cnsgithub 0
  • ionCheckRadio removes data attributes

    ionCheckRadio removes data attributes

    Hi,

    please take a look at the generated dom markup: http://codepen.io/anon/pen/Mwryvm

    This behavior has changed in version 2.0. In version 1.1.0 i was able to read the html5 data attributes.

    This markup:

    <div class="demo__block-element">
      <input type="radio" name="reading" value="1" id="reading_1" data-foo="bar1" />
      <label for="reading_1">Sometimes</label>
    </div>
    

    is generating:

    <div class="demo__block-element">
    <label class="icr-label">
    <span class="icr-item type_radio"></span>
    <span class="icr-hidden"><input type="radio" value="1" name="reading" class="icr-input "></span>   <span class="icr-text">Sometimes</span>
    </label>
    </div>
    

    data-foo="bar1" has been removed :-(

    question 
    opened by joke1 2
  • Unable init ionCheckRadio when trying to apply to already initiated element

    Unable init ionCheckRadio when trying to apply to already initiated element

    Hello Den,

    So, here is the flow:

    1. Add dynamically the new input.
    2. Try to apply init ionCheckRadion to all checkbox and radio. Example: http://jsfiddle.net/Stafox/u2L66mdv/

    Note: when you try to init ionCheckRadio on new element only - all works as expected: http://jsfiddle.net/Stafox/s3qLjyuj/

    bug 
    opened by Stafox 3
Releases(2.0.0)
Owner
Denis Ineshin
JavaScript developer
Denis Ineshin
A jQuery UI plugin to handle multi-tag fields as well as tag suggestions/autocomplete.

Tag-it: a jQuery UI plugin Tag-it is a simple and configurable tag editing widget with autocomplete support. Homepage Demo Check the examples.html for

Alex Ehlke 2.5k Dec 20, 2022
Magically convert a simple text input into a cool tag list with this jQuery plugin.

jQuery Tags Input Plugin Do you use tags to organize content on your site? This plugin will turn your boring tag list into a magical input that turns

XOXCO 2.3k Dec 23, 2022
Simple-load-more - This jQuery function will add a functionality to load 5 (or custom) more items. No AJAX functionality.

Simple Load More This jQuery plugin will add a functionality to load 5 (or custom) more items. Best for lists that are long and you want to hide all e

Zeshan Ahmed 28 Jan 4, 2023
Automatically persist your forms' text and select field values locally, until the form is submitted.

Garlic.js Garlic.js allows you to automatically persist your forms' text and select field values locally, until the form is submitted. This way, your

Guillaume Potier 2.4k Dec 21, 2022
Add live paragraph-, word- and character-counting to an HTML element.

Countable Countable is a JavaScript function to add live paragraph-, word- and character-counting to an HTML element. Countable is a zero-dependency l

Sacha Schmid 1.6k Dec 2, 2022
typeahead.js is a fast and fully-featured autocomplete library

typeahead.js Inspired by twitter.com's autocomplete search functionality, typeahead.js is a flexible JavaScript library that provides a strong foundat

Twitter 16.5k Jan 4, 2023
A set of flat and 3D progress button styles where the button itself serves as a progress indicator

A set of flat and 3D progress button styles where the button itself serves as a progress indicator. 3D styles are used for showing the progress indication on one side of the button while rotating the button in perspective.

Codrops 608 Oct 19, 2022
Highly customizable checkboxes and radio buttons (jQuery & Zepto)

iCheck plugin 1.0.3 Highly customizable checkboxes and radio buttons for jQuery and Zepto. Refer to the iCheck website for examples. Note: iCheck v2.0

Dar Gullin 7.4k Dec 25, 2022
Highly customizable checkboxes and radio buttons (jQuery & Zepto)

iCheck plugin 1.0.3 Highly customizable checkboxes and radio buttons for jQuery and Zepto. Refer to the iCheck website for examples. Note: iCheck v2.0

Dar Gullin 7.5k Aug 24, 2022
Easy and simple to use Radio Buttons for your React Native Application.

React Native Simple Radio Buttons Easy and simple to use Radio Buttons for your React Native Application. Installation npm i react-native-custom-radio

Neelesh Ranjan Jha 2 Feb 8, 2022
Functional, simple and customizable UI buttons for react native. Also contains loading functionality and automatically changes color for dual tone buttons. TypeScript support.

React Native UI Buttons ✨ Installation If you want to use icons make sure you have react-native-vector-icons installed in your project. npm install --

Hussain Pettiwala 6 Dec 5, 2022
Grupprojekt för kurserna 'Javascript med Ramverk' och 'Agil Utveckling'

JavaScript-med-Ramverk-Laboration-3 Grupprojektet för kurserna Javascript med Ramverk och Agil Utveckling. Utvecklingsguide För information om hur utv

Svante Jonsson IT-Högskolan 3 May 18, 2022
Hemsida för personer i Sverige som kan och vill erbjuda boende till människor på flykt

Getting Started with Create React App This project was bootstrapped with Create React App. Available Scripts In the project directory, you can run: np

null 4 May 3, 2022
Kurs-repo för kursen Webbserver och Databaser

Webbserver och databaser This repository is meant for CME students to access exercises and codealongs that happen throughout the course. I hope you wi

null 14 Jan 3, 2023
Fancytree - JavaScript tree view / tree grid plugin with support for keyboard, inline editing, filtering, checkboxes, drag'n'drop, and lazy loading

Fancytree Fancytree (sequel of DynaTree 1.x) is a JavaScript tree view / tree grid plugin with support for keyboard, inline editing, filtering, checkb

Martin Wendt 2.6k Jan 9, 2023
RxHtmlButtonLibrary - Html Button Styling Library by roxunlimited.com using CSS and jQuery.

rxHTMLButton Library v0.3 rxHTMLButton Library will work on almost every HTML tag. It will smoothly work on 'a href link', 'button type button', 'inpu

roxunlimited 0 Sep 16, 2022
Easy and flexible jQuery tabbed functionality without all the styling.

JQuery EasyTabs Plugin Tabs with(out) style. EasyTabs creates tabs with all the functionality, no unwanted changes to your markup, and no hidden styli

Steve Schwartz 553 Nov 23, 2022
iOS 7 style switches for your checkboxes

Description Switchery is a simple component that helps you turn your default HTML checkbox inputs into beautiful iOS 7 style switches in just few simp

Alexander Petkov 2.1k Dec 31, 2022
A JavaScript library for creating "select-all" checkboxes

SelectAllCheckbox v1.0 See LICENSE for this software's licensing terms. SelectAllCheckbox is a JavaScript library which makes it easy to create "selec

Kurtis LoVerde 1 Jul 27, 2021
Converts select multiple elements into dropdown menus with checkboxes

jquery-multi-select Converts <select multiple> elements into dropdown menus with a checkbox for each <option>. The original <select> element is hidden

mySociety 22 Dec 8, 2022