Skip to content

Instantly share code, notes, and snippets.

@bensochar
Created February 25, 2014 19:19
Show Gist options
  • Save bensochar/9215688 to your computer and use it in GitHub Desktop.
Save bensochar/9215688 to your computer and use it in GitHub Desktop.
Wrap Checkbox Inputs so you can style them.
jQuery(document).ready(function($) {
$(':checkbox').wrapCheckboxInputs();
});
(function($) {
$.fn.wrapCheckboxInputs = function() {
return this.each(function () {
var _label = $(this).closest("label.checkbox");
var _nme = this.name;
var _id = this.id;
$(this).wrap('<div class="box" data-id="'+_id+'"></div>').wrap('<div class="check" data-id="'+_id+'"></div>');
});
}
})(jQuery);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment