I have a menu that I’m building that looks something like this:
<ul id="myUl">
<li><span>li #1</span>
<ul>
<li>
<div class="myContent">
<a href="" name="myLink">clickMe!</a>
</div>
</li>
</li>
</ul>
So, i’d like to define a click handler for the <a> tag of the ul with the id of "myUl".
I tried something like a css selector like:
$('ul[id="myUl] a').on('click', do stuff!);
or
$('ul[id="myUl] > a').on('click', do stuff!); //this doesn’t work because a is not a direct child of ul.
What’s the correct way of handeling clicks of just the a element of this specific ul?
Very simple: