jQuery find parent form

前端 未结 5 1771
名媛妹妹
名媛妹妹 2020-12-07 10:13

i have this html

5条回答
  •  感动是毒
    2020-12-07 10:40

    I would suggest using closest, which selects the closest matching parent element:

    $('input[name="submitButton"]').closest("form");
    

    Instead of filtering by the name, I would do this:

    $('input[type=submit]').closest("form");
    

提交回复
热议问题