jQuery modal window removes elements from my form

前端 未结 6 2044
隐瞒了意图╮
隐瞒了意图╮ 2021-02-08 14:00

jQuery, when i use it to create a modal window which contains form elemets, it takes out those elements when i submit the form.

example of the form:

<         


        
6条回答
  •  佛祖请我去吃肉
    2021-02-08 14:26

    I just had the same problem. I solved it by adding another

     
    

    at the end (but inside) of the form and then you have to add this to jQuery:

    $("form").submit(function() {
        $("#add_photo").prependTo("#beforesubmit");
    });
    

    This will make sure that before the form is submit your dialog div will be put back in between the form tags. Thanks to arnorhs I came to this solution.

    Cheers!

提交回复
热议问题