I have the following HTML structure:
<ul>
<li>
1- First Level
</li>
<li>
<ul>
<li>2 - Second Level</li>
</ul>
</li>
</ul>
I have the following jQuery
$(document).on('click','li',function(){
var text = $(this).html();
alert(text);
});
When I click on the li having the text 1- First Level, the click event is triggered.
But when I click on the sub li having text 2- Second Level, the trigger fires on the first li (since it is the parent)..
How can I trigger the click event on each li regardless of its status (parent/child)?