As a fully functional JS Toolkit, Dojo provides a unified approach to DOM manipulation.
Dojo.byid
The Dojo.byid function allows you to select a DOM node through the id attribute. This function is an alias for the standard document.getElementById function, but it is obviously short and easy to write.
Dojo.query
Although Dojo.byid can easily get a DOM node based on the ID, it is almost impossible to get each element based on the ID, because the ID is uniquely identified. If you want to get a few elements at once, we can pass the Dojo.query method.
The Dojo.query function takes a string argument and uses a CSS3 selector to refer to the element you want to select. This works much like jquery's manipulation of the DOM. If we want to get all the elements of a class in a page, we just need to use the following code:
Dojo.query (". Class")
This method will return a nodelist, and we can manipulate each element by traversing the list.
Dojo.body
The Dojo.body method returns the BODY element of document
Dojo.create
Dojo.create method creates an element
Dojo.destroy
The Dojo.destroy method removes the element from the parent element and deletes all child elements of the element
Dojo.empty
The Dojo.empty method removes all child elements
Dojo.foreach
The Dojo.foreach method allows an iterator to be defined for an array or a nodelist to access each item in the arrays or nodelist and to provide the appropriate action.
This method ignores the return value and does not support break.
Getting Started with Dojo: DOM operations