JQuery how to stop event propagation -


i'm looking stop event propagating every time click "done", alert shows once.

here code:

$('body').on('click', '#product', function () {      var x = "hi";     $('#done').click(function () {         alert(x);     });  }); 

and fiddle: http://jsfiddle.net/s4sz29ew/1/

$('body').on('click', '#product', function () {      var x = "hi";     $('#done').click(function (e) {         alert(x); e.stoppropagation();     });  }); 

Comments

Popular posts from this blog

python - pip install -U PySide error -

arrays - C++ error: a brace-enclosed initializer is not allowed here before ‘{’ token -

cytoscape.js - How to add nodes to Dagre layout with Cytoscape -