This is my code
<ul>
<li id="menu_house" class="main_menu "><a class="main_menu " href="searchHouse.php"><span>Houses</span></a></li>
<li id="menu_apartment" class="main_menu "><a class="main_menu " href="searchApartment.php"><span>Apartments</span></a></li>
<li id="menu_building" class="main_menu "><a class="main_menu " href="searchBuilding.php"><span>Buildings</span></a></li>
</ul>
I want to add a class to first <a>
tag when page is loading, I know how to add menu_house
<div>
, like this:
$("#menu_house").addClass("selected");
How can I add a class to the <a>
tag?