Aryan PrajapatKnowledge Contributor
What are the different methods to find HTML elements in DOM
What are the different methods to find HTML elements in DOM
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Questions | Answers | Discussions | Knowledge sharing | Communities & more.
If you want to access any element in an HTML page, you need to start with accessing the document object. Later you can use any of the below methods to find the HTML element,
document.getElementById(id): It finds an element by Id
document.getElementsByTagName(name): It finds an element by tag name
document.getElementsByClassName(name): It finds an element by class name