javascript - Creating a clickable div within a div -


For some reason I can not do this simple:

 for  (var i = 0; I & lt; result.label; i ++) {var object = result [i]; $ ("# Recipes_names") Attachment ("& lt; div id =" + "recipe" + i + "& gt;"); $ ("# Recipes_names") attached (object.get ('recipe_title')). Console.log (object); Console.log (object.id + '-' + object.get ('recipe' title ')); $ ("#nusfie 1"). Click (function (e) {e.stopPropagation (); warning ("click inside");); }},  

I create divs in "recpie_names" div with name "recipe0" / "recipe1" etc. and can not make them clickable for my life. I am convinced that I am making the smallest mistakes of those mistakes that I am making here but I can not neal it down. Can you give me a hand?

Add a class for the divis that has been added and instead of adding an event to the id The base only adds an event to the class selector and simply writes to the event:

  $ ("# recipes_names") .andend ("

and:

  $ (document) .on ("click", "recipe", function (e) {e.stopPropagation (); warning ("Click inside");});  

Comments

Popular posts from this blog

c# - SignalR: "Protocol error: Unknown transport." when navigating to hub -

c# - WPF Expander overlay used in ItemsControl -

class - Kivy: how to instantiate a dynamic classes in python -