Ignore Parent onClick event when Child element is clicked
If the case is avoid clicking on elements inside them, this will help you.
function clickhere(obj){
let theid = obj.id;
console.log(theid);
event.stopPropagation();
}
The idea is to remove onclick=""
handler saving its value in another field and then to execute (evaluate) value in custom click
event handler:
Example code.
$(document).ready(function()
{
var elements = $(".ticket-selector");
elements.each(function()
{
var handler = $(this).attr('onclick');
$(this).data('click', handler);
});
elements.attr('onclick', '');
elements.click(function(e)
{
if (!$(e.target).hasClass("info-sign"))
{
eval($(this).data('click'));
}
});
});
Check the working demo HERE
I think you should use event.stopPropagation() jquery api and you can use it as
$(document).ready(function(){
$('.tickets-more').click(function(event){
// your stuff here
alert("Alert On Click");
event.stopPropagation();
});
});
event.stopPropagation() stop the event bubbling that you are facing. For further documentation refer the from HERE
Hope it helps...