The bubble event up the DOM to their parent elements. What you need to do is attach the event to ulanother event of the child elements li, which uses stopPropagation():
jQuery("ul.wrap")
.on('click', function(){
})
.on('click', 'li', function(e) {
e.stopPropagation();
});
source
share