Skip to content

Commit 5b238ea

Browse files
Jesse StrebScott Jehl
authored andcommitted
https://github.com/jquery/jquery-mobile/issues#issue/578 Updated to use the selector that Scott suggested in order to make checkboxes not dissappear. One issue I noticed is that the page still transitions to the 'new' page even though it is really the same page. I have a fix for this that will post in a separate drop.
1 parent 1a21b05 commit 5b238ea

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

js/jquery.mobile.forms.checkboxradio.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ $.widget( "mobile.checkboxradio", $.mobile.widget, {
1111
},
1212
_create: function(){
1313
var input = this.element,
14-
label = $("label[for='" + input.attr( "id" ) + "']"),
14+
label = $(input).closest("form,fieldset,[data-role='page']").find("label[for='" + input.attr( "id" ) + "']"),
1515
inputtype = input.attr( "type" ),
1616
checkedicon = "ui-icon-" + inputtype + "-on",
1717
uncheckedicon = "ui-icon-" + inputtype + "-off";
@@ -76,7 +76,7 @@ $.widget( "mobile.checkboxradio", $.mobile.widget, {
7676

7777
refresh: function( ){
7878
var input = this.element,
79-
label = $("label[for='" + input.attr( "id" ) + "']"),
79+
label = $(input).closest("form,fieldset,[data-role='page']").find("label[for='" + input.attr( "id" ) + "']"),
8080
inputtype = input.attr( "type" ),
8181
icon = label.find( ".ui-icon" ),
8282
checkedicon = "ui-icon-" + inputtype + "-on",

0 commit comments

Comments
 (0)