How can you empty an element and re-use the elements and keep event handlers etc.?
<div></div>
var inp = $('<input type="text" />')
.keydown(function(){
alert('keydown');
});
$('div').append(inp);
$('div').empty();
$('div').append(inp);
all event handlers and etc. is destroyed when you empty an element.. how can you avoid this?
Use detach on the child instead:
If you have multiple elements
From the documentation on
empty: