Doing javascript on an appended HTML item within an accordion
<p>Okay, so I'm populating an accordion with JSON data. The only way I know how to do this is by appending HTML to the div. Here's my code:</p>

<pre><code>$.getJSON('/industry_tree.json', function(data) {
    $("#accordion").accordion();
    for (i in data) {
        acc_html += '&lt;h3&gt;&lt;a href="#"&gt;'+data[i].data+'&lt;/a&gt;&lt;/h3&gt;';
        acc_html += '&lt;div&gt;';
        for (j in data[i].children) {
            acc_html += '&lt;li&gt;'+data[i].children[j].data+'&lt;/li&gt;';                        
        }
        acc_html += '&lt;/div&gt;';
    }                   
    console.log(acc_html);
    $("#accordion").append(acc_html);   
    $("#accordion").accordion("destroy").accordion({autoHeight: false});        
});
</code></pre>

<p>I want the <code>&lt;li&gt;</code> to execute some sort of JS everytime it's clicked. The problem is, I'm not sure how to do that if I'm adding it via an append.</p>
