Jquery – I need to give an element the same class as another element
<div class='topnav' id='myTopnav'> <div class='dropdown'> <button class=' dropbtn'>Adobe ▼</button> <div class='dropdown-content'> <a href='index'>Photoshop</a> </div> </div> </div> <script> jQuery(function($) { var path = window.location.href; $('#myTopnav a').each(function() { if (this.href === path) { $(this).addClass('active'); $(this).parent().parent('first-child').addClass('active'); } }); }); </script> I am not…