Permalink
Browse files

Checkboxradio: ensure proper input order is maintained in the dom dur…

…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 4ab19a70766d40382940c86427ffd3dc8e95e1ad
Showing with 11 additions and 2 deletions.
  1. +11 −2 js/widgets/forms/checkboxradio.js
@@ -61,6 +61,7 @@ $.widget( "mobile.checkboxradio", $.extend( {
$.extend( this, {
input: input,
label: label,
parentLabel: parentLabel,
inputtype: inputtype,
checkedClass: checkedClass,
uncheckedClass: uncheckedClass,
@@ -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,

0 comments on commit 4ab19a7

Please sign in to comment.