Jquery append input element and send data from that input element
<p>I have this simple HTML code:</p>

<pre><code>&lt;div id="new_gallery"&gt;
    &lt;p id="add_gallery"&gt;Add new gallery&lt;/p&gt;
&lt;/div&gt;
</code></pre>

<p>and jQuery code:</p>

<pre><code>&lt;script&gt;
    $("#add_gallery").click(function() {
        $("#new_gallery").append('&lt;input name"new_gallery" /&gt;&lt;a href="#" id="create_new_gallery"&gt;Add&lt;/a&gt;');
        $(this).remove();
    });

    $("#create_new_gallery").on('click', function(){
        alert('1'); 
    });
&lt;/script&gt;
</code></pre>

<p>First function is working, but second one is not. I need to create new <code>input</code> element, send data via ajax, and then delete the <code>input</code> element and append a <code>p</code> element once again. How can I do this?</p>
