Last active
          August 29, 2015 13:56 
        
      - 
      
- 
        Save bensochar/9220093 to your computer and use it in GitHub Desktop. 
Revisions
- 
        bensochar revised this gist Feb 26, 2014 . 1 changed file with 71 additions and 1 deletion.There are no files selected for viewingThis file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1 +1,71 @@ jQuery(document).ready(function($) { $('label :checkbox').checkedChange(); $('label :checkbox').wrapCheckboxInputs(); $('label :radio').radioChange(); }); (function($) { $.fn.wrapRadioInputs = function() { return this.each(function() { var _label = $(this).closest("label.radio"); 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>'); }); } $.fn.radioChange = function(_class) { _class = _class || "checked"; return this.each(function() { var _label = $(this).closest("label.radio"); var _nme = this.name; if (!navigator.userAgent.match(/MSIE/)) { $(this).change(function() { $('label[for="' + _nme + '"]').removeClass(_class); $(this).is(":checked") ? _label.addClass(_class) : _label.removeClass(_class); }) } else { $(_label).click(function() { $('label[for="' + _nme + '"]').removeClass(_class); $(':radio', this).is(":checked") ? _label.addClass(_class) : _label.removeClass(_class); }) } $(this).focus(function() { $(_label).addClass("focus"); }); $(this).blur(function() { $(_label).removeClass("focus"); }); }); }; $.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>'); }); } $.fn.checkedChange = function(_class) { _class = _class || "checked"; return this.each(function() { var _label = $(this).closest("label.checkbox"); var _nme = this.name; if (!navigator.userAgent.match(/MSIE/)) { $(this).change(function() { $(this).is(":checked") ? _label.addClass(_class) : _label.removeClass(_class); }); } else { $(this).click(function() { $(this).is(":checked") ? _label.addClass(_class) : _label.removeClass(_class); }); } $(this).focus(function() { $(_label).addClass("focus"); }); $(this).blur(function() { $(_label).removeClass("focus"); }); }); }; })(jQuery); 
- 
        bensochar revised this gist Feb 26, 2014 . 1 changed file with 1 addition and 71 deletions.There are no files selected for viewingThis file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,71 +1 @@ rfrf 
- 
        bensochar revised this gist Feb 26, 2014 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewingThis file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -3,6 +3,7 @@ jQuery(document).ready(function($) { $('label :checkbox').wrapCheckboxInputs(); }); (function($) { $.fn.wrapRadioInputs = function() { return this.each(function () { 
- 
        bensochar revised this gist Feb 26, 2014 . 1 changed file with 30 additions and 30 deletions.There are no files selected for viewingThis file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -5,59 +5,59 @@ jQuery(document).ready(function($) { (function($) { $.fn.wrapRadioInputs = function() { return this.each(function () { var _label = $(this).closest("label.radio"); 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>'); }); } $.fn.radioChange = function (_class) { _class = _class || "checked"; return this.each(function () { var _label = $(this).closest("label.radio"); var _nme = this.name; if(!navigator.userAgent.match(/MSIE/) ) { $(this).change(function() { $('input[name="' + _nme + '"]').closest("label.radio").removeClass(_class); $(this).is(":checked") ? _label.addClass(_class) : _label.removeClass(_class); }) } else { $(_chk).click(function() { $('input[name="' + _nme + '"]').closest("label.radio").removeClass(_class); $(':radio', this).is(":checked") ? _label.addClass(_class) : _label.removeClass(_class); }) } $(this).focus(function() { $(_label).addClass("focus"); }); $(this).blur(function() { $(_label).removeClass("focus"); }); }); }; $.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>'); }); } $.fn.checkedChange = function (_class) { _class = _class || "checked"; return this.each(function () { var _label = $(this).closest("label.checkbox"); var _nme = this.name; if(!navigator.userAgent.match(/MSIE/) ) { $(this).change(function() { $(this).is(":checked") ? _label.addClass(_class) : _label.removeClass(_class); }); } else { $(this).click(function() { $(this).is(":checked") ? _label.addClass(_class) : _label.removeClass(_class); }); } $(this).focus(function() { $(_label).addClass("focus"); 
- 
        bensochar revised this gist Feb 26, 2014 . 1 changed file with 30 additions and 30 deletions.There are no files selected for viewingThis file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -5,59 +5,59 @@ jQuery(document).ready(function($) { (function($) { $.fn.wrapRadioInputs = function() { return this.each(function() { var _label = $(this).closest("label.radio"); 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>'); }); } $.fn.radioChange = function(_class) { _class = _class || "checked"; return this.each(function() { var _label = $(this).closest("label.radio"); var _nme = this.name; if (!navigator.userAgent.match(/MSIE/)) { $(this).change(function() { $('label[for="' + _nme + '"]').removeClass(_class); $(this).is(":checked") ? _label.addClass(_class) : _label.removeClass(_class); }) } else { $(_label).click(function() { $('label[for="' + _nme + '"]').removeClass(_class); $(':radio', this).is(":checked") ? _label.addClass(_class) : _label.removeClass(_class); }) } $(this).focus(function() { $(_label).addClass("focus"); }); $(this).blur(function() { $(_label).removeClass("focus"); }); }); }; $.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>'); }); } $.fn.checkedChange = function(_class) { _class = _class || "checked"; return this.each(function() { var _label = $(this).closest("label.checkbox"); var _nme = this.name; if (!navigator.userAgent.match(/MSIE/)) { $(this).change(function() { $(this).is(":checked") ? _label.addClass(_class) : _label.removeClass(_class); }); } else { $(this).click(function() { $(this).is(":checked") ? _label.addClass(_class) : _label.removeClass(_class); }); } $(this).focus(function() { $(_label).addClass("focus"); 
- 
        bensochar revised this gist Feb 26, 2014 . 1 changed file with 32 additions and 2 deletions.There are no files selected for viewingThis file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,10 +1,41 @@ jQuery(document).ready(function($) { $('label :checkbox').checkedChange(); $('label :checkbox').wrapCheckboxInputs(); }); (function($) { $.fn.wrapRadioInputs = function() { return this.each(function () { var _label = $(this).closest("label.radio"); 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>'); }); } $.fn.radioChange = function (_class) { _class = _class || "checked"; return this.each(function () { var _label = $(this).closest("label.radio"); var _nme = this.name; if(!navigator.userAgent.match(/MSIE/) ) { $(this).change(function() { $('input[name="' + _nme + '"]').closest("label.radio").removeClass(_class); $(this).is(":checked") ? _label.addClass(_class) : _label.removeClass(_class); }) } else { $(_chk).click(function() { $('input[name="' + _nme + '"]').closest("label.radio").removeClass(_class); $(':radio', this).is(":checked") ? _label.addClass(_class) : _label.removeClass(_class); }) } $(this).focus(function() { $(_label).addClass("focus"); }); $(this).blur(function() { $(_label).removeClass("focus"); }); }); }; $.fn.wrapCheckboxInputs = function() { return this.each(function () { @@ -36,5 +67,4 @@ jQuery(document).ready(function($) { }); }); }; })(jQuery); 
- 
        bensochar revised this gist Feb 26, 2014 . 1 changed file with 13 additions and 12 deletions.There are no files selected for viewingThis file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,32 +1,33 @@ jQuery(document).ready(function($) { $('label :checkbox').checkedChange(); $('label :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>'); }); } $.fn.checkedChange = function (_class) { _class = _class || "checked"; return this.each(function () { var _label = $(this).closest("label.checkbox"); var _nme = this.name; if(!navigator.userAgent.match(/MSIE/) ) { $(this).change(function() { $(this).is(":checked") ? _label.addClass(_class) : _label.removeClass(_class); }); } else { $(this).click(function() { $(this).is(":checked") ? _label.addClass(_class) : _label.removeClass(_class); }); } $(this).focus(function() { $(_label).addClass("focus"); }); 
- 
        bensochar revised this gist Feb 25, 2014 . 1 changed file with 3 additions and 2 deletions.There are no files selected for viewingThis file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,9 +1,9 @@ jQuery(document).ready(function($) { $('label :checkbox').checkedChange(); $('.lt-ie9 label :checkbox').checkedChangeClick(); $('label :checkbox').wrapCheckboxInputs(); }); (function($) { @@ -14,7 +14,8 @@ jQuery(document).ready(function($) { var _label = $(this).closest("label.checkbox"); var _nme = this.name; $(_label).click(function() { $(':checkbox', this).is(":checked") ? _label.addClass(_class) : _label.removeClass(_class); }); }); }; 
- 
        bensochar revised this gist Feb 25, 2014 . 1 changed file with 13 additions and 1 deletion.There are no files selected for viewingThis file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,13 @@ jQuery(document).ready(function($) { $('label :checkbox').checkedChange(); $('.lt-ie9 label :checkbox').checkedChangeClick(); }); (function($) { $.fn.checkedChangeClick = function (_class) { _class = _class || "checked"; return this.each(function () { @@ -23,4 +33,6 @@ $(_label).removeClass("focus"); }); }); }; })(jQuery); 
- 
        bensochar created this gist Feb 25, 2014 .There are no files selected for viewingThis file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,26 @@ $.fn.checkedChangeClick = function (_class) { _class = _class || "checked"; return this.each(function () { var _label = $(this).closest("label.checkbox"); var _nme = this.name; $(_label).click(function() { _label.hasClass(_class) ? _label.removeClass(_class) : _label.addClass(_class); }); }); }; $.fn.checkedChange = function (_class) { _class = _class || "checked"; return this.each(function () { var _label = $(this).closest("label.checkbox"); var _nme = this.name; $(this).change(function() { $(this).is(":checked") ? _label.addClass(_class) : _label.removeClass(_class); }); $(this).focus(function() { $(_label).addClass("focus"); }); $(this).blur(function() { $(_label).removeClass("focus"); }); }); };