0

what type of values given to getElementById() method

3 Answers 3

1

getElementById expects a string.

The following code:

var element = document.getElementById('myId');

finds the following element and assigns it to element

<div id="myId"></div>
Sign up to request clarification or add additional context in comments.

Comments

1

just pass the id of any element like <input type="text" id="text" /> just use getElementById("text")

Comments

0

a single DOM object, of a specialized class depending on the nature of the element identified by the given ID

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.