click-event with a created id with append()?
<p>Is it possible to make an click-event with a created id with append()?</p>

<p>Example:</p>

<pre><code>$('body').append('&lt;div id="backbutton"&gt; &lt;p&gt;BACK&lt;/p&gt; &lt;/div&gt;');

$('#backbutton').click(function(){ 
    $('#map').hide(); 
});
</code></pre>

<p>This is the jQuery file... It does nothing, no errors in console</p>

<pre><code>$('#nycskyline').hide();
$('#gotonyc').hide();
$('#NYC').click(function(){

    $('body').append('&lt;div id="backbutton"&gt; &lt;p&gt;BACK&lt;/p&gt; &lt;/div&gt;');




    });

});

$('#backbutton').click(function(){
    $('#map').css('visibility','visible');

});
</code></pre>

<p>Thanks</p>

<p>ANSWER//</p>

<p>This works for me: I made 2 click events on the NYC id. One for hide the map and other elements and one for append the backbutton. In the second click event I made a new click event for the backbutton. I know this isn't clean code but it works so I'm happy atm.</p>

<p>Thanks for helping.    </p>

<pre><code>$('#NYC').click(function(){
    $('body').append('&lt;div id="backbutton"&gt; &lt;p&gt;BACK&lt;/p&gt; &lt;/div&gt;');
    $('#backbutton').click(function(){
        $(this).hide();
        $('#map').css('visibility','visible');
        $('#hintszoom').css('visibility', 'visible');
        $('#stedenlist').css('visibility', 'visible');
        $('#nycskyline').hide();
        $('.textbuildingnyc').remove();
        $('#textnyc, #textbuilding4, #textbuilding3, #textbuilding2,
                    #textbuilding1').remove();
    });
});
</code></pre>
