javascript - clone content tag <template> in jQuery -


i'm trying clone contents of tag jquery, i'm unable copy events linked child elements, how can it?

you can use clone() method, setting both withdataandevents , deepwithdataandevents parameters true:

var $templateclone = $('template').clone(true, true); 

see: http://api.jquery.com/clone/

or alternatively, can use plain clone() method no parameters, , use event delegation bind events common parent instead.


Comments

Popular posts from this blog

1111. appearing after print sequence - php -

excel - I can't get the attachement of the email PHP -

node.js - Express and Redis - If session exists for this user, don't allow access -