jquery to run clone function with multiple selectors -


$(document).ready(function() {     $(".add_file_group, .clone_email2, .clone_email").click(function() {         $("#clone_file_group").clone().insertafter("div#clone_file_group:last");         console.log(this);     }); }); 

using function different selectors in 1 section, 1 selector working

as class name clone_email2, .clone_email suggest these generated dynamically. need use delegate event handler

try this

 $(document).on('click', '.add_file_group, .clone_email2, .clone_email', function () {          $("#clone_file_group").clone().insertafter("div#clone_file_group:last");      }); 

description: attach handler 1 or more events elements match selector, or in future, based on specific set of root elements.


Comments

Popular posts from this blog

amazon web services - S3 Pre-signed POST validate file type? -

c# - Check Keyboard Input Winforms -