How can I make jQuery work even on objects not yet created?
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/2238616/binding-dynamically-created-elements-in-jquery">Binding dynamically created elements in jQuery</a>  </p>
</blockquote>



<p>Is there a way I can change the following code:</p>

<pre><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("");
        });
</code></pre>

<p>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:</p>

<pre><code>&lt;select class="update-title"&gt; 
</code></pre>

<p>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() ?</p>
