+ 1

Hello greetings, I am new and I have some doubts about what is "getElementById" and what does it belong to ...

If I'm not mistaken "getElementById" is a method of the document object, but I have searched in various ways for the properties and methods of the document object and nowhere does "getElementById" appear, so I'm not sure what it is or what area it belongs to, anyway with "addEventListener", please ask for your help with this for my guidance and excuse the ignorance, thanks

16th Jun 2021, 1:39 PM
Willi
1 Resposta
0
getElementById mean that you can access element. Example. <div id = "hello> </div> var hello1 = document.getElementById("hello"); Now I am accessed an element by id hello. hello1.innerHTML = "I am From Javascript"; Hope you understand!
16th Jun 2021, 1:53 PM
Sajid Ali
Sajid Ali - avatar