Question

How can I remove all elements found by a class name. I want to do this using the dojo framework.

Was it helpful?

Solution 2

Try the below code.

<div id="list">
    <div class="odd">One</div>
    <div class="even">Two</div>
    <div class="odd">Three</div>
    <div class="even">Four</div>
    <div class="odd">Five</div>
    <div class="even">Six</div>
</div>



dojo.query(".odd").forEach(function(node, index, nodelist){
    // for each node in the array returned by dojo.query,
    // execute the following code
    dojo.remove(node);
});

Referred below links :

https://dojotoolkit.org/reference-guide/1.7/dojo/destroy.html

http://dojotoolkit.org/documentation/tutorials/1.6/using_query/

Thanks,

Siva

OTHER TIPS

Try with this:

dojo.query(".class_name").forEach(dojo.destroy);

DEMO

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top