{"id":180,"date":"2014-11-24T18:21:49","date_gmt":"2014-11-24T18:21:49","guid":{"rendered":"https:\/\/www.joetannorella.com\/?p=180"},"modified":"2014-11-24T18:23:31","modified_gmt":"2014-11-24T18:23:31","slug":"jquery-clone-inputs-selects-working","status":"publish","type":"post","link":"https:\/\/www.joetannorella.com\/jquery-clone-inputs-selects-working\/","title":{"rendered":"jQuery clone inputs and selects not working"},"content":{"rendered":"
Use clone(true) to attach handlers to all new inputs. Kinda like updating the DOM.<\/p>\n
\r\n$('.add-new-office').click(function(event) {\r\n event.preventDefault();\r\n $(this).closest('.additional-offices-container').clone(true).appendTo('.multiple-offices-container');\r\n});\r\n<\/pre>\n<\/p>\n
If you don’t do this, your cloned selectors won’t have any JS handlers attached to them and will for all intents and purposes not be contained within the DOM.<\/p>\n","protected":false},"excerpt":{"rendered":"
Use clone(true) to attach handlers to all new inputs. Kinda like updating the DOM. If you don’t do this, your cloned selectors won’t have any JS handlers attached to them and will for all intents and purposes not be contained within the DOM.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[7],"tags":[],"yoast_head":"\n
jQuery clone inputs and selects not working - JoeTannorella.com<\/title>\n\n\n\n\n\n\n\n\n\n\n\n\n\t\n