javascript - JQuery - How do i submit the cloned forms? -


How do I submit all clone forms at the same time?

I have created a script to clone

HTML

  & lt; Div id = 'forms' & gt; & Lt; div class = 'cform' & gt; & Lt; Form id = 'form' method = 'POST' & gt; & Lt; Input style = 'width: 80px;' Class = 'hihi' type = 'submit' name = 'add_jo' value = 'submit all' / & gt; & Lt; Td> & Lt; Input class = 'txtedit' placeholder = 'job name' type = 'text' name = 'which []' maximum length = '130' /> & Lt; / Td> & Lt; / Form & gt; & Lt; / Div & gt; & Lt; / Div & gt;   

JQuery

  $ ('clone'). Click on (function (event) {event.preventDefault (); var tr = $ ('. Cform: first'); var newTr = tr.clone (); newTr.find (": input"). Val ('' ); // Find all input types (Input, Teddera), clear it newTr.appendTo (Tr.parent ());});    

Submitting a form is triggering the request for new page loads, this Type You Can not Submit Many Forms Try to collect in hidden form to collect values ​​of all forms as simultaenously, or use some AJAX to work without submitting form data.

Alternatively, you can clone the content of your form to expand the form.

  & lt; Form action = "..." method = "post" & gt; & Lt; Div class = "clonable" & gt; & Lt; Input name = "data []" value = "" /> & Lt; / Div & gt; & Lt; Button ID = "Expansion" & gt; Clone & lt; / Button & gt; & Lt; Button type = "submit" id = "submit" & gt; Submit & lt; / Button & gt; & Lt; / Form & gt;   

Your JS may look like this:

  $ ("# extension"). Click (function () {$ (".cloneable") clone (). Before insert ($ ("# extension"));};    

Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -