I have the following html code-
<div class="search_results">...</div>
<div class="search_results">...</div>
<div class="search_results">...</div>
The divs are automatically generated by a javasciprt function. Is there a way to access only the first div/or a specific div of the same class name “search_results” with javascript?
If you use JQuery
$(".search_results").first(). Else you need to usedocument.getElementsByClassName("search_results")[0];