How do I select the parent form based on which submit button is clicked?

前端 未结 5 850
孤城傲影
孤城傲影 2020-12-02 07:57

I have a web page with 3 forms on it. Not nested, just one after the other (they are almost identical, just one hidden variable that\'s different). A user will only fill i

5条回答
  •  感情败类
    2020-12-02 08:11

    i used the following method & it worked fine for me

    $('#mybutton').click(function(){
            clearForm($('#mybutton').closest("form"));
        });
    

    $('#mybutton').closest("form") did the trick for me.

提交回复
热议问题