html - stopPropagation in Javascript -


Let me click on to fire the event.

"snippet-code">
  function (e) {e.stopPropagation (); Console.log ('its result'); }  
  & lt; Div id = "overlay" onclick = "something" & gt; & Lt; Div id = "image-wrapper" & gt; & Lt; Img src = "image.jpg" id = "popup image" alt = "[image]" & gt; & Lt; / Div & gt; & Lt; / Div & gt;  

I do not want click on the image . Only in the overlay

You preventDefault () on img

  $ ("img") Click (function (e) {e.preventDefault (); e.stopPropagation (); console.log ("click the stop");});  


Comments