There are two <div> same class. On the page one above the other.
How to remove one of the (upper) ones with JS?

 <div class="someclass">.....</div> <div id="1">.......</div> <div id="2">.....</div> <div class="someclass">.....</div> 

  • Thanks for the feedback! I wonder which of the options will be faster? The first, as I understand it, also forms an array of class elements? - user281210

2 answers 2

Try $ ('. Someclass: first'). Remove ();

     document.getElementsByClassName('someclass')[0].remove() 
     <div class="someclass">someclass #1</div> <div id="1">обычный #1</div> <div id="2">обычный #2</div> <div class="someclass">someclass #2</div>