What's the best way to dynamically add elements to a tree menu in jquery? When I use the append() method to add another (li) 'some code' (/li) to extend my tree menu, the code is added but doesn't become live. Is there another method I should use开发者_C百科 instead of append(). Any help is appreciated. Brett
It totally depends on how you attached events in the first place:
To have events attached also to elements created after the DOM is ready you could use live()
$('yourselector').live("click", function(){
//put what to do after a click event
});
精彩评论