Reputation: 75
what is the difference between Element Object (JavaScript) and Element (HTML)?
"Element is the most general base class from which all objects in a Document inherit. It only has methods and properties common to all kinds of elements." - Element Object
The reason I am confused is that ive heard from reputable websites for learning coding say that getElementById() returns an element whose id property matches the specified string but MDN says that getElementById() returns an Element object representing the element whose id property matches the specified string.
Upvotes: 0
Views: 283
Reputation: 56
simply because DOM considers all HTML elements as Objects so the both definitions are almost similar namely correct
Upvotes: 4
Reputation: 119
i think they are the same... getElementById() return the element with the id, you can assign it to a variable in js if that what you ment
Upvotes: 1