zepto - Zeptojs on() not triggering -


I created a plugin (pluginA) based on zeptojs And inside this plugin I get data using Ajax and and

How do these anchors attach a list of how to tie an event? I & lt; A href = "..." data-key = "ABC123" & gt; & Lt; / A & gt; Like it was going for something at the global level and then $ ('[data-key]'). PluginB () and then inside pluginB () is something

$ (this) .on ('click', function (e) {e .preventDefault (); ...}); But I'm not able to bind the click event to the dynamically created anchor.

I would like to actually do two plugins to reduce the $ (

For the bind () trigger () approach is to use, but I'm having trouble finding a good example.

Use on representative to link all the desired links in a particular area (in this example, whole body): < / P>

  $ (body) .on ('click', 'a data-key]', function (e) {e.preventDefault (); ...});   

now All links with data-keys will trigger your function, even if they are not present when you click on ; Links added later will automatically get behavior , And the deleted links will not leak memory by holding dangerous handler references.

Comments

Popular posts from this blog

excel vba - How to delete Solver(SOLVER.XLAM) code -

github - Teamcity & Git - PR merge builds - anyway to get HEAD commit hash? -

ios - Replace text in UITextView run slowly -