As a fully functional JS toolkit, Dojo provides a unified Dom operation method.
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 short and easy to write.
Dojo. Query
Although dojo. byid can easily obtain a DOM node by ID, it is almost impossible to obtain each element by ID because ID is a unique identifier. To obtain several elements at a time, we can use the dojo. query method.
The dojo. query function accepts a string parameter and uses a css3 selector to reference the element you want to select. This operation is similar to jquery's Dom operations. To obtain all the elements of a class on the page, you only need to use the followingCode:
Dojo. Query (". Class ")
This method returnsNodelist. We can traverse this list to operate each element.
Dojo. Body
The dojo. Body method returns the body element of the document.
Dojo. Create
The dojo. Create method creates an element.
Dojo. Destroy
The dojo. Destroy method deletes this element from the parent element and deletes all child elements of this element.
Dojo. Empty
The dojo. Empty method deletes all child elements.
Dojo. foreach
The dojo. foreach method allows you to define an iterator for an array or nodelist to access each item in an array or nodelist and provide corresponding operations.
This method ignores the returned values and does not support break.
There are also many other useful methods that can be viewed in the http://dojotoolkit.org/api/