javascript - jQuery function not working for dynamically added field -
i added group of fields dynamically. , assign class jquery function it. first row working fine when insert send row jquery function not working. insert dynamic field same class.
$(".catg").change(function(){ var classes = $(this).parents('.col-sm-3').parents('.input-group').attr('id'); alert(classes); });
you should use .on()
create delegated events:
$(document).on('change', '.catg', function(){ var classes = $(this).parents('.col-sm-3').parents('.input-group').attr('id'); alert(classes); });
Comments
Post a Comment