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

java - WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/board/] in DispatcherServlet with name 'appServlet' -

android - How to create dynamically Fragment pager adapter -

html - Outlook 2010 Anchor (url/address/link) -