Can you nest html forms?

前端 未结 20 3162
悲&欢浪女
悲&欢浪女 2020-11-21 04:56

Is it possible to nest html forms like this

so

20条回答
  •  花落未央
    2020-11-21 05:11

    Plain html cannot allow you to do this. But with javascript you can be able to do that. If you are using javascript/jquery you could classify your form elements with a class and then use serialize() to serialize only those form elements for the subset of the items you want to submit.

    Then in your javascript you could do this to serialize class1 elements

    $(".class1").serialize();
    

    For class2 you could do

    $(".class2").serialize();
    

    For the whole form

    $("#formid").serialize();
    

    or simply

    $("#formid").submit();
    

提交回复
热议问题