Skip to content
Permalink
Browse files

Button: Support elements that are disconnected from the DOM.

Fixes #5246 - _determineButtonType does not work if a label for checkbox/radiobutton is not yet attached to the document.
  • Loading branch information...
scottgonzalez committed Mar 11, 2010
1 parent 5df420e commit fe6bef16e40c6e1847f26e20630914c42a6fb8cf
Showing with 4 additions and 1 deletion.
  1. +4 −1 ui/jquery.ui.button.js
@@ -158,7 +158,10 @@ $.widget( "ui.button", {
: "button";

if ( this.type === "checkbox" || this.type === "radio" ) {
this.buttonElement = $( "[for=" + this.element.attr("id") + "]" );
// we don't search against the document in case the element
// is disconnected from the DOM
this.buttonElement = this.element.parents().last()
.find( "[for=" + this.element.attr("id") + "]" );
this.element.addClass('ui-helper-hidden-accessible');

var checked = this.element.is( ":checked" );

0 comments on commit fe6bef1

Please sign in to comment.
You can’t perform that action at this time.