Skip to content

Commit d97add1

Browse files
committed
Combobox: Added a destroy method. Fixes #6685 - Combobox: Doesn't handle destroy.
1 parent 9ade710 commit d97add1

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

demos/autocomplete/combobox.html

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
select = this.element.hide(),
2525
selected = select.children( ":selected" ),
2626
value = selected.val() ? selected.text() : "";
27-
var input = $( "<input>" )
27+
var input = this.input = $( "<input>" )
2828
.insertAfter( select )
2929
.val( value )
3030
.autocomplete({
@@ -81,7 +81,7 @@
8181
.appendTo( ul );
8282
};
8383

84-
$( "<button>&nbsp;</button>" )
84+
this.button = $( "<button>&nbsp;</button>" )
8585
.attr( "tabIndex", -1 )
8686
.attr( "title", "Show All Items" )
8787
.insertAfter( input )
@@ -104,6 +104,13 @@
104104
input.autocomplete( "search", "" );
105105
input.focus();
106106
});
107+
},
108+
109+
destroy: function() {
110+
this.input.remove();
111+
this.button.remove();
112+
this.element.show();
113+
$.Widget.prototype.destroy.call( this );
107114
}
108115
});
109116
})( jQuery );

0 commit comments

Comments
 (0)