I'm using the .each method with the .getJSON method to print out objects in a JSON file.  This works fine, however I am unable to add a click function to an element that has been printed out.  I am trying to bind a function to the div with 'click' ID.
var loadData = function () {
    $.getJSON("profiles2.json", function (data) {
        var html = [];
        html.push("<div id='click'>Click here</div>");
        $.each(data.profiles, function (firstIndex, firstLevel) {
            html.push("<h2>" + firstLevel.profileGroup + "</h2>");
        });
        $("#data").html(html.join(''));
    });
};
$(document).ready(function () {
    loadData();
    $("#click").click(function () {
        console.log('clicked');
    });
});
 
     
    