Reputation: 2597
I'm clicking on ul tag and it has many li tags.. which ever li tag I click it should add a class "open" . Here is my code
$(document).on('click', '.navbar', function(e) {
$(this).find('li').addClass('open');
});
<ul class='navbar'>
<li></li>
<li></li>
</ul>
Upvotes: 0
Views: 144
Reputation: 690
$('.navbar li').on('click', function(e){
$(this).addClass('open');
});
Upvotes: 1