开发者

Newly created elements without jquery expando attribute aren't maintained by jquery?

I have collapsable/expandable tree created in jQuery. After loading the tree:

$("#tree").treeview({
        collapsed: true,
        animated: "medium",
        control: "#sidetreecontrol",
        persist: "location"
    });

I have expando data attribute on the nodes, for example:

Newly created elements without jquery expando attribute aren't maintained by jquery?

I've written some code which appends new nodes to my existing ones, basically by creating new <ul><li> html elements. So after appending a new node, I have additional ul container, but without jQueryxxxxx... attribute:

Newly created elements without jquery expando attribute aren't maintained by jquery?

While I'm able to expand and collapse nodes initialized on page loading, I'm not able to interact with the nodes I've added later, because they're not cached... ? I don't understand that and I don't know how to fi开发者_开发技巧x it to be able to collapse and expand nodes I've created after the tree is initialized.

Regards


By default no elements have the jQuery expando attribute, it's added when events or data are added to the element. This is something your .treeview() plugin is doing, e.g. adding click handlers. You'll have to look at the plugin and see it's support for new elements...if they aren't added or recognized by the plugin, they'll have no "tree-ish" behavior.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜