<div class="main-div">
<p class="no-select"><a href="#."><span class="my-icon"></span>Foo1</a></p>
<p><a href="#.">Foo2</a></p>
<p><a href="#.">Foo3</a></p>
<p><a href="#.">Foo4</a></p>
</div>
This is my DOM structure. What is the better way to write onclick event of
I tried two way:
First by giving each
tag a unique ID. and catching those ID click event. I think this is weired.
So I tried next way:
$("div.main-div > p ").click(function(e) {
alert('hi');
return false;
});
But it is not working for me. Where I am wrong..
Try this out:
main-divis a class not an id