dojo.destroy

Project owner:Peter Higgins
Available:since V1.3

Destroys a DOM element. dojo.destroy deletes all children and the node itself.

Introduction

dojo.destroy removes a node from its parent, clobbering it and all of its children.

Usage

1
2
3
4
<script type="text/javascript">
  // Destroy a node byId:
  dojo.destroy("someId");
</script>

This function only works with DomNodes, and returns nothing.

Parameter Type Description
node String|DomNode A String ID or DomNode reference of the element to be destroyed.

Examples

Destroy a single node

Destroy all nodes in a list by reference

<style type="text/css">
.stay { width: 30px; height: 30px; border: 1px #4d4d4d solid; margin-top: 4px; margin-right: 5px; float: left; background-color: green }
.go { width: 30px; height: 30px; border: 1px #4d4d4d solid; margin-top: 4px; margin-right: 5px; float: left; background-color: red }
</style>
Error in the documentation? Can’t find what you are looking for? Let us know!