Opened 10 years ago

Closed 10 years ago

Last modified 7 years ago

#5339 closed bug (duplicate)

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 10 years ago.
Contains an html file that demonstrates the bug and the fix, as well as two screenshots of IE and Firefox.

Download all attachments as: .zip

Change History (3)

Changed 10 years ago by cmathis430

Attachment: ui-button events test.zip added

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

comment:1 Changed 10 years ago by Scott González

Resolution: duplicate
Status: newclosed

Duplicate of #5261.

comment:2 Changed 7 years ago by Scott González

Milestone: TBD

Milestone TBD deleted

Note: See TracTickets for help on using tickets.