Levi
Levi

Reputation: 12472

How to remove the node from the page?

I'm having some trouble removing a node from the NodeList using the orphan() function, hoping someone can help me out.

I've got the following code:

dojo.connect(dojo.byId("close"), "onclick", function(){
    console.log('close was clicked');
    dojo.query("view-bg").orphan();
    dojo.query("view-image").orphan();
});

I believe I am misunderstanding how the orphan function is used, but this is the most useful documentation I found so far: http://dojotoolkit.org/api/1.3/dojo/NodeList/orphan

When I click on the element the console does log my message so I know it is getting to that point, but for some reason the div with an id of 'view-bg' and 'view-image' are not being removed.

Thanks, Levi

Upvotes: 1

Views: 2944

Answers (1)

mrtom
mrtom

Reputation: 2156

You probably need to adjust your query. If 'view-bg' and 'view-image' are ID's, use '#view-bg' and '#view-image'. If they're CSS classes, use '.view-bg' and '.view-image'.

That should work!

Also, docs for the latest (1.5) release are available at http://dojotoolkit.org/

API: http://dojotoolkit.org/api/ Docs: http://dojotoolkit.org/documentation

Tom

Upvotes: 4

Related Questions