How to use the class from added code in the jquery function
I create html code with jquery. <span id="myspan">aa</span> <input id="btn" type="button" value="click"> Now I want to call a function created by clicking on the code class. function loadSpan() { var _html = "<a class=\"addItem\">test</a>"; $(‘#myspan’).html(_html); } $(function(){ $(‘#btn’).click(function(){ loadSpan(); }); $(‘.addItem’).click(function(){ alert("OK"); }); }) but is not working. I testing this code, and working: $(function(){… Read More How to use the class from added code in the jquery function