Check out example codes for "js get html element". It will help you in understanding the concepts better.

Code Example 1

var myElement = document.getElementById("intro");

Code Example 2

document.getElementById('[ID]') // returns live HTML Element Object
document.getElementsByClassName('[CLASS]') // returns live HTML Collection Object
document.getElementsByName('[NAME]') // returns live HTML Collection Object
document.getElementsByTagName('[ELEMENT-TYPE]') // returns live HTML Collection Object

Code Example 3

//The are 3 methods to access or find HTML Elements

let myId = document.getElementById(uniqueId);	
let paragraph = document.getElementsByTagName(p);
let myClass = document.getElementsByClassName(name);

Learn ReactJs, React Native from