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

Commit 4ab19a7

Browse files
committed
Checkboxradio: ensure proper input order is maintained in the dom durring enhancment. Fixes #339 - Checkboxes don't work when used with ROR checkbox helper
1 parent 6fa8ecf commit 4ab19a7

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

js/widgets/forms/checkboxradio.js

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ $.widget( "mobile.checkboxradio", $.extend( {
6161
$.extend( this, {
6262
input: input,
6363
label: label,
64+
parentLabel: parentLabel,
6465
inputtype: inputtype,
6566
checkedClass: checkedClass,
6667
uncheckedClass: uncheckedClass,
@@ -89,10 +90,18 @@ $.widget( "mobile.checkboxradio", $.extend( {
8990
},
9091

9192
_enhance: function() {
92-
9393
this.label.addClass( "ui-btn ui-corner-all");
94+
95+
if( this.parentLabel.length > 0 ){
96+
this.input.add( this.label ).wrapAll( this._wrapper() );
97+
} else {
98+
//this.element.replaceWith( this.input.add( this.label ).wrapAll( this._wrapper() ) );
99+
this.element.wrap( this._wrapper() );
100+
this.element.parent().prepend( this.label );
101+
}
102+
94103
// Wrap the input + label in a div
95-
this.input.add( this.label ).wrapAll( this._wrapper() );
104+
96105
this._setOptions({
97106
"theme": this.options.theme,
98107
"iconpos": this.options.iconpos,

0 commit comments

Comments
 (0)