I have applied fancybox to the parent element, but when i try to click a button inside it, it will also trigger the fancy box which is not the expected result
<div data-img-id="256" data-fancybox="" href="https://www.14.jpg" >
<button >Select</button>
</div>
so when i click button inside the parent, it is also triggering the fancybox, please guide
CodePudding user response:
Simply prevent event event bubbling and/or prevent default action inside your click event:
event.preventDefault();
event.stopPropagation();