html() and click handler
<p>I initially got this code and all works well:</p>

<pre><code>&lt;div class="rm"&gt;
        &lt;button id="sub" type="submit"&gt;
            &lt;span&gt;Registo&lt;/span&gt;
        &lt;/button&gt;
    &lt;/div&gt;

   &lt;script type="text/javascript"&gt;
    $(document).ready(function() {
        $(".rm&gt;#sub").click(function(event) {
            event.preventDefault();
            var formdata = $("#custom").serialize();
            $.ajax({
                url: "dojo/insert.php",
                type: "post",
                dataType: "json",
                data: formdata,
                success: function(data) {
                    switch (data.livre) {

                    case 'error':
                        $(".rm").html('&lt;button id="sub"  type="submit"&gt;&lt;span&gt;Rever&lt;/span&gt;&lt;/button&gt;');
                        break;                    

                    default:
                        $('#paginas').delay(50).load('profile_empresa_3.php');          
                        break;
                    }
                }
            });
            return false;              
        });
    });
    &lt;/script&gt;
</code></pre>

<p>The problem now. When i add <code>$(".rm").html("")</code> with a button with the same id. If i click in this new button the page is reloaded. My question is. If the button added has the same id, why the click handler is not repeated ?</p>

<p>thanks</p>
