get first element javascript in document code example
Example: js get first element by class
var elements = document.getElementsByClassName('className');
var requiredElement = elements[0];
var elements = document.getElementsByClassName('className');
var requiredElement = elements[0];