1

I have a php page with a form for a login.

<form role="form" id="contactForm">
    <input type="text" id="inputName" required>
    <input type="password" id="inputPassword" required>
    <button type="submit">ACCEDI</button>
 </form>
<div id="risposta"></div>

On the bottom of the page I load a .js to execute this form in jQuery and the page, on success return a new form on div #risposta but this form cannot be executed like the first. When I click on the submit button of the 2nd form it reload the page and do nothing. 1st form works as needed.

js code:

$("#contactForm").on("submit", function (event) {
    event.preventDefault();
    submitForm();
});
$("#conferma").on("submit", function (event) {
    console.log( 'Conferma Dati' );
    event.preventDefault();
    submitConfermaDati();
});

hmtl of 2nd form generated by first:

<form role="form" id="conferma" class="form-signin">
    <input type="hidden" id="utf_id" value="1">
    <input type="text" id="rag_sociale" class="form-control"  value="">
    <input type="text" id="utf_nome" class="form-control" value="" required="">
    ----- more input -----      
    <button type="submit">CONFERMA</button>
</form>
Milad Rashidi
  • 1,296
  • 4
  • 22
  • 40
Saxcbr
  • 47
  • 9

0 Answers0