Skip to content
This repository has been archived by the owner on Oct 8, 2021. It is now read-only.

Commit

Permalink
Checkboxradio: ensure proper input order is maintained in the dom dur…
Browse files Browse the repository at this point in the history
…ring enhancment. Fixes #339 - Checkboxes don't work when used with ROR checkbox helper
  • Loading branch information
arschmitz committed Aug 6, 2013
1 parent 6fa8ecf commit 4ab19a7
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions js/widgets/forms/checkboxradio.js
Expand Up @@ -61,6 +61,7 @@ $.widget( "mobile.checkboxradio", $.extend( {
$.extend( this, {
input: input,
label: label,
parentLabel: parentLabel,
inputtype: inputtype,
checkedClass: checkedClass,
uncheckedClass: uncheckedClass,
Expand Down Expand Up @@ -89,10 +90,18 @@ $.widget( "mobile.checkboxradio", $.extend( {
},

_enhance: function() {

this.label.addClass( "ui-btn ui-corner-all");

if( this.parentLabel.length > 0 ){
this.input.add( this.label ).wrapAll( this._wrapper() );
} else {
//this.element.replaceWith( this.input.add( this.label ).wrapAll( this._wrapper() ) );
this.element.wrap( this._wrapper() );
this.element.parent().prepend( this.label );
}

// Wrap the input + label in a div
this.input.add( this.label ).wrapAll( this._wrapper() );

this._setOptions({
"theme": this.options.theme,
"iconpos": this.options.iconpos,
Expand Down

0 comments on commit 4ab19a7

Please sign in to comment.