[Solved] Difference between getElementById and createElement in javascript? [closed]
The main difference is that getElementById will get an element from the DOM by it’s ID attribute, and createElement will create an entirely new DOM element. Let’s say you had a page with the following HTML: <!doctype html> <html> <head> </head> <body> <div>Hello, World!</div> <div id=”message”>What a nice day!</div> </body> </html> And then you had … Read more