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

Popular posts from this blog

ZeroMQ on Windows, with Qt Creator -

unity3d - Unity SceneManager.LoadScene quits application -

python - Error while using APScheduler: 'NoneType' object has no attribute 'now' -