I have this test code that works perfectly except the autocomplete stops working the second time the dialog is opened. I need to open the dialog this way using html because i want it to open really fast, and this was the best way. Why does autocomplete stop working the second time?
var $container = $('#container'),
$input = $container.find('input:eq(0)');
var source = new Array(2);
source[0] = { value: 1000, label: 'Description' };
source[1] = { value: 1001, label: 'Description' };
$input.autocomplete({ source: source });
var $dialog = $('<div></div>').dialog({
autoOpen: false,
modal: true,
beforeclose: function() { $dialog.html(''); }
});
$('#open').click(function() {
$dialog.dialog('open').html($container);
});
EDIT: The reason I use html like this is because i want to open an empty dialog to speed it up. Doing it like this makes the dialog seem alot more responsive. I want to continue opening the dialog this way. The mystery remains, why does event handlers and autocomplete stop working the second time i open the dialog this way? Nothing has changes in $container or $input.