jquery - Doing javascript on an appended HTML item within an accordion -



jquery - Doing javascript on an appended HTML item within an accordion -

okay, i'm populating accordion json data. way know how appending html div. here's code:

$.getjson('/industry_tree.json', function(data) { $("#accordion").accordion(); (i in data) { acc_html += '<h3><a href="#">'+data[i].data+'</a></h3>'; acc_html += '<div>'; (j in data[i].children) { acc_html += '<li>'+data[i].children[j].data+'</li>'; } acc_html += '</div>'; } console.log(acc_html); $("#accordion").append(acc_html); $("#accordion").accordion("destroy").accordion({autoheight: false}); });

i want <li> execute sort of js everytime it's clicked. problem is, i'm not sure how if i'm adding via append.

once appended, can manipulate same way else on page.

for instance:

$("#accordion li").click(function(){...});

javascript jquery

Comments

Popular posts from this blog

How do I check if an insert was successful with MySQLdb in Python? -

delphi - blogger via idHTTP : error 400 bad request -

postgresql - ERROR: operator is not unique: unknown + unknown -