.parent().remove() issue

后端 未结 5 963
慢半拍i
慢半拍i 2021-01-01 18:26

I have a jQuery-based form where you can add extra people to the application. I\'m cloning the first fieldset and adding it onto the end up to a max of 3 additional people.

5条回答
  •  爱一瞬间的悲伤
    2021-01-01 18:41

    You can do this for delete the parent:

     $(document).on("click", ".remove", function() { 
          $(this).parent().remove(); 
     });
    

    or you can do this for delete all parents:

     $(document).on("click", ".remove", function() { 
          $(this).parents().remove();
     });
    

提交回复
热议问题