开发者

Dynamically adding content to a tree menu

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
});
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜