Course Theme: DOM

DOM: creating elements

Last updated by on 1.11.22

Manipulating the DOM: creating elements In this course, we are going to see what it means to "create elements" on the web page, thereby directly manipulating the DOM using the document.createElement() method. Manipulating the DOM: document.createElement() Creates an HTML element on the page specified by tagName, or an HTMLUnknownElement if tagName is not recognized. Make it a habit, however, of creating recognized elements only! Syntax: Parameters: nodeName (type String): Required. The name of the element you want to create. Return value: a new Element. Code Example: The above code is a helper function taken from the Monsters API App. You may have noticed that there are no quotes around the element argument passed in to document.createElement(). […]

Continue reading »