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
Post a Comment