Permalink
Browse files

remove checked state from radio button inputs that are not checked. u…

…se jquery attr accessor instead of expando to guarantee consistent values. Fixes #1532.
  • Loading branch information...
johnbender committed May 2, 2011
1 parent d9e4762 commit 377c0067a7d1103821be4899b02f21b132f1fbcc
Showing with 10 additions and 1 deletion.
  1. +10 −1 js/jquery.mobile.forms.checkboxradio.js
@@ -58,7 +58,14 @@ $.widget( "mobile.checkboxradio", $.mobile.widget, {
}
self._cacheVals();
input.attr( "checked", inputtype === "radio" && true || !input.is( ":checked" ) );
// input set for common radio buttons will contain all the radio
// buttons, but will not for checkboxes. clearing the checked status
// of other radios ensures the active button state is applied properly
self._getInputSet().not(input).removeAttr('checked');
self._updateAll();
return false;
}
@@ -116,7 +123,9 @@ $.widget( "mobile.checkboxradio", $.mobile.widget, {
label = this.label,
icon = label.find( ".ui-icon" );
if ( input[0].checked ) {
// input[0].checked expando doesn't always report the proper value
// for checked='checked'
if ( $(input[0]).attr('checked') ) {
label.addClass( $.mobile.activeBtnClass );
icon.addClass( this.checkedicon ).removeClass( this.uncheckedicon );

1 comment on commit 377c006

@johnbender

This comment has been minimized.

Show comment
Hide comment
@johnbender

johnbender May 2, 2011

Contributor

I'm not convinced this is the best way to get the job done but the checked state was not being managed for radio buttons properly which was causing the active button problems as described in the fixed issue. Input is welcome!

Contributor

johnbender commented on 377c006 May 2, 2011

I'm not convinced this is the best way to get the job done but the checked state was not being managed for radio buttons properly which was causing the active button problems as described in the fixed issue. Input is welcome!

Please sign in to comment.