Possible Duplicate:
Binding dynamically created elements in jQuery
Is there a way I can change the following code:
$('#city')
.focus(function () {
$('option[value="99"]', this).remove();
store.setItem($(this).attr('id'), $(this).val());
})
.change(function () {
store.setItem($(this).attr('id'), $(this).val());
$(this).attr("title", $("option:selected", this).attr("title"));
$('#detailData').html("");
});
So that it works for selects even if they have not yet been created as long as they have the class "update-title". for example:
<select class="update-title">
I saw some implementation using live but someone said it was not good to use. Also is there much of an overhead doing this. Would it be better for me to add the code after I am sure the selects have been created with document.ready() ?