Attach event listener to dynamic element
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/8021436/jquery-1-7-turning-live-into-on">jQuery 1.7 - Turning live() into on()</a>  </p>
</blockquote>



<p>I used to love the <code>.live()</code> function that jQuery had. You would add it and voila, any future elements that matched the identifier would have that function.</p>

<p>Then it got deprecated and it was advised to use <code>.on()</code>. But it doesn't work. Below is my code that is placed in <code>$(document).ready()</code>.</p>

<p><strong>This works</strong></p>

<pre><code>$('#membership_number').live('change',function(e) {
    alert("VALUE CHANGED");
});
</code></pre>

<p><strong>This doesn't</strong></p>

<pre><code>$('#membership_number').on('change',function(e) {
    alert("VALUE CHANGED");
});
</code></pre>

<p>Is there another way to achieve the same effect as <code>.live()</code> or am I just not using <code>.on()</code> correctly?</p>
