jQuery, bind focus method to dynamic input element
<p>I have a login form, which contains simple text box, that shows the text 'Password'. When a user clicks the box, i.e. on focus event, I replace the text box html with password box html, with same id, same everything else.</p>

<p>However, after this change, the focus event does not work on the password box anymore, even though it has the same id. Do I need to do anything extra? like bind function to the password box. Please show me how to do it, with some code snippets. Thanks.</p>

<p>Here's my code:</p>

<pre><code>$(".login_fields input")
  .focus(function (e) {
      $(this).parent().html('&lt;input type="password" value="" id="admin_password"&gt;');
      $(this).val('');
  })
</code></pre>
