I need to find all elements with the same class name and address the first one

Solution:1

I prefer to work with data- attribute instead of classes

data-date="feb34454" instead of class="feb34454"

See the next example

 

$(document).ready(function(){
  $(".ct-nestable-shortcode").each(function(){
    let the_date = $(this).find("> div").data('date');
    $("[data-date='"+the_date+"']:first").css("background" , "yellow");
  });
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div class="ct-nestable-shortcode">
  <div data-date="feb34454">feb34454</div>
</div>
<div class="ct-nestable-shortcode">
  <div data-date="feb34454">feb34454</div>
</div>
<div class="ct-nestable-shortcode">
  <div data-date="feb34454">feb34454</div>
</div>

Solution:2

var elements = document.getElementsByClassName(“class-1”);
for (var i = 0, len = elements.length; i < len; i++) {
// elements[i].style …
}

Solution:3

var allHiddenElements = document.getElementsByClassName(“hidden”);

Solution:4

document.querySelectorAll(“[class^=page]”)