To avoid putting it all into one unreadable line. Jörn
On Fri, Jun 27, 2008 at 3:00 AM, Alexsandro_xpt <[EMAIL PROTECTED]> wrote: > > Jorn, Why you always declare a new JS var? > > > -- > www.alexsandro.com.br > > > > On 22 jun, 16:14, "Jörn Zaefferer" <[EMAIL PROTECTED]> > wrote: >> Just use jQuery methods to find the node: >> >> var node = $("...").appendTo("#products .someNode"); >> ... >> >> Jörn >> >> On Sun, Jun 22, 2008 at 2:25 PM, SirHoundalot <[EMAIL PROTECTED]> wrote: >> >> > Hi all >> >> > I'm using the async version of the treeview plugin by Jörn Zaefferer. >> > I'd really like the ability to dynamically add nodes to the treeview, >> > but am experiencing some difficulties in doing so. >> >> > Currently I've managed to get top-level leaf nodes added using the >> > following code: >> >> > function addNode(cssClass,newName){ >> > var node = $("<li><span >> > class='"+cssClass+"'>"+newName+"</span><ul></ >> > ul></li>").appendTo("#products"); >> > $("#products").treeview({add: node});} >> >> > where #products is the id of the ul that contains the tree. >> >> > I can't work out how to add nodes elsewhere in the hierarchy though - >> > is there a way to specify which parent to add the new nodes to? >> >> > Thanks! >