Skip to main content

Search and Top Navigation

#5339 closed bug (duplicate)

Opened March 12, 2010 09:02PM UTC

Closed March 13, 2010 02:11AM UTC

Last modified October 11, 2012 09:15PM UTC

checkbox and radio events do not fire in IE

Reported by: cmathis430 Owned by:
Priority: minor Milestone:
Component: ui.button Version: 1.8rc3
Keywords: button, events, IE Cc:
Blocked by: Blocking:
Description

When converting checkboxes and radios into ui.buttons, the events do not fire in IE because IE does not fire events for elements that are not visible.

Line 158 is the culprit. You need to hide the input element by moving it off the page, rather than setting display:none;

This is the fix that I am using:

i.e. $('input[type="checkbox"]').button().show()'''.css({ 'position': 'absolute', 'left': '-999em' })''';

http://dev.jqueryui.com/browser/trunk/ui/jquery.ui.button.js?rev=3862

147	        _determineButtonType: function() {
148	                this.type = this.element.is( ":checkbox" )
149	                        ? "checkbox"
150	                        : this.element.is( ":radio" )
151	                                ? "radio"
152	                                : this.element.is( "input" )
153	                                        ? "input"
154	                                        : "button";
155	
156	                if ( this.type === "checkbox" || this.type === "radio" ) {
157	                        this.buttonElement = $( "[for=" + this.element.attr("id") + "]" );
158	                        this.element.hide();
159	
160	                        var checked = this.element.is( ":checked" );
161	                        if ( checked ) {
162	                                this.buttonElement.addClass( "ui-state-active" );
163	                        }
164	                        this.buttonElement.attr( "aria-pressed", checked );
165	                } else {
166	                        this.buttonElement = this.element;
167	                }
168	        },
Attachments (1)
  • ui-button events test.zip (36.6 KB) - added by cmathis430 March 12, 2010 09:05PM UTC.

    Contains an html file that demonstrates the bug and the fix, as well as two screenshots of IE and Firefox.

Change History (2)

Changed March 13, 2010 02:11AM UTC by scottgonzalez comment:1

resolution: → duplicate
status: newclosed

Duplicate of #5261.

Changed October 11, 2012 09:15PM UTC by scottgonzalez comment:2

milestone: TBD

Milestone TBD deleted