1
I was curious to discover that it is possible to recover an HTML element using its ID as a Javascript variable.
Then the question arose to me: what is the difference between document.getElementById
and elementoID
and which modes should be used/which situations?
Follow a brief example of what I’m saying:
console.log(divExemplo);
//Mesma coisa!
console.log(document.getElementById('divExemplo'));
<div id="divExemplo"></div>