iCheck checkboxes not displaying

kwyoung11 picture kwyoung11 · Aug 28, 2013 · Viewed 14.7k times · Source

I can't get the iCheck iCheckbox plugin to display in any browser.

Here is a jSFiddle. iCheck depends on jQuery 1.7+.

http://jsfiddle.net/jmj3M/2/

I have it initialized without any options:

$(".ex-f").iCheck();

As you can see if you inspect the DOM, the input element is being wrapped by the iCheckbox div. Both the <input> and <ins> elements have their opacity set to 0, however.

Changing their opacity via jQuery, you get this: http://jsfiddle.net/buRq7/

Unfortunately, it still does not work. Does anyone have any advice or experience on getting this to work?

I'm using rails 4 and the asset pipeline.

EDIT: I just realized I selected no-library (pure JS) as a framework option in jsFiddle, and it seems to work even without changing the opacity (see: http://jsfiddle.net/buRq7/5/). However, the documentation explicitly says that it depends on jQuery (or Zepto). Switching the framework option to jQuery 1.10.1 leads to the iCheckbox no longer functioning again ... not sure why this is.

Answer

Becario Senior picture Becario Senior · Jun 19, 2014

just .iCheck() without any parameter won't work. You need the following at least:

 $('input').iCheck({
            checkboxClass: 'icheckbox_minimal-grey',
            radioClass: 'iradio_minimal-grey'
        });