开发者

unregister/delete all child nodes of a div tag in dojo

开发者 https://www.devze.com 2023-01-29 12:50 出处:网络
I have a div tag, lets say \"mydivTag\" It has a child node under it with an ID of \"childID\" I want to delete/unregister/whatever \"childID\" and then recreate a different node with the same ID, \

I have a div tag, lets say "mydivTag"

It has a child node under it with an ID of "childID"

I want to delete/unregister/whatever "childID" and then recreate a different node with the same ID, "childID"

How do I achieve r开发者_如何学编程emoval of the first object with ID "childID" so that when I make my new object with that same ID, I don't get an error about there already being a widget registered with the ID "childID"

Thanks


have you tried something like

dojo.query("#childID", mydivTag).orphan()

then

dojo.create("div", {id: "childID"}, mydivTag)

These are just shorthand for DOM APIs like removeChild and createElement

0

精彩评论

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

关注公众号