0

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.

2 Answers 2

4

simply because DOM considers all HTML elements as Objects so the both definitions are almost similar namely correct

Sign up to request clarification or add additional context in comments.

Comments

1

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.