JQuery: How to attach event to template objects? -


i have template generates images , binding div.

<script id="posttemplate" type="text/html"> <div class="post_1">     <div class="postimage"><img src="${imageurl}" alt="image"></div> </div> </script> 

then bind data

<script>     $("#posttemplate").tmpl(clientdata).appendto("#imagesarea"); </script> 

now, want add event handlers created. like

("template img").error(function() {}); 

adding handlers things click seems work, error fires off before can add handler seems.

not sure selector "template img" referencing since dont see template elements.

$(function(){      $('template img').live({       click: function() {         // on click       },       error: function() {         // on error       }     }); }); 

http://api.jquery.com/live/


Comments

Popular posts from this blog

php - What is the difference between $_SERVER['PATH_INFO'] and $_SERVER['ORIG_PATH_INFO']? -

fortran - Function return type mismatch -

queue - mq_receive: message too long -