Add click handler to LI bullet

I would like to add a jQuery handler specifically for the bullet on LI. Currently, when I click on any of the WITHIN LI elements, the LI click handler fires. Instead, it should be just a bullet, not some content.

+5
source share
2 answers

you will need to create your own bullet, perhaps as a div with a background image.

+4
source

If you want to keep your own bullet, you can do this:

HTML:

<li><span>Text here</span></li>

JS:

$('li').click(function(event) {
    if (event.target.tagName != 'LI') return;

    alert('clicked bullet');
});
+8
source