GetElementbyId Properties | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

GetElementbyId Properties

What are more properties in getelement.id apart from style. color, background, and value?

5th May 2018, 12:43 AM
love
2 Answers
+ 1
Hi love There is getElementbyID and getElementsbyID (notice the small difference). We also now have document.querySelector and its matching document.querySelectorALL. The latter allows you to target an elements by its CSS attributes. All of an elements properties are accessible using above, so what is the difference? see this discussion https://www.sololearn.com/Discuss/1218711/get-vs-query
5th May 2018, 7:15 AM
Mike Choy
Mike Choy - avatar
0
Hello there! .innerhtml - allows you to manipulate the HTML inside the element; .attributes - let's you access element's attributes; .childNodes - returns an array of elements inside the element with that ID; Etc, but personally this bunch were enough for me to manage quite some stuff during projects ahahah doing a quick Google search you'll find more info regarding this matter and a bunch of examples
5th May 2018, 4:13 AM
Diogo Leite
Diogo Leite - avatar