fortherest fortherest - 1 year ago 93
HTML Question

Remove dynamic current element

I have form and Add button bottom of te form which is the right..and whenever click it's adding new a form with delete button and if I click it has to delete current form

my js code


and if you want you can see full demo and js files

codepen demo

Answer Source

You have to register the listener to watch all new elements too. And you want to use closest, not parents.

Even you dont need the closest too, you can select the .group directly, because your delete button is inside that element:

$(document).on("click", ".iade_sil", function() {
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download