Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

99
Views
Creating FORM programetically - .submit won't activate

The form I created will not activate .submit. There are no ids or names = 'submit'. The 'Go Back' button functions as coded. Program goes back to calling page. The 'Update' input type=submit does nothing. I don't know how to fix this as web developer tools doesn't show a hint of what's wrong.

[The image is of the functioning Form '#revForm']

$(function () {
    
    var form_str="";
    var fields=<?php echo json_encode($fields); ?>;
    var cfields=<?php echo json_encode($capFields); ?>;
    var qdata=<?php echo json_encode($qdata); ?>;


    $("#returnvalbox").show();

    $(".formcontainer").append("<form id='revForm' name='revForm' method='post' action='#'>");

    var i=0;

    Object.keys(qdata).forEach(key => {  // create the form body

        if (key=="id") {   // you can't edit the id
            form_str="<label for='"+key+"'>"+cfields[i++]+" </label>";
            form_str+="<input  type='text' class='body' ";
            form_str+="id='"+key+"'name='"+key+"' value='"+qdata[key]+"' readonly  ><br>";  
        }else {
            form_str="<label for='"+key+"'>"+cfields[i++]+" </label>";
            form_str+="<input  type='text' class='hov body' ";
            form_str+="id='"+key+"'name='"+key+"' value='"+qdata[key]+"'><br>"; 
        } 


    $(".formcontainer").append(form_str);

    }); //Object.keys
    
    $(".formcontainer").append("<br><input  type='submit' class='cbut hov' value='Update'>")
                    .append("&nbsp;&nbsp;<button type='button' class='cbut hov' id='bak'>Go Back</button><p></p>");
    $(".formcontainer").append("</form>");
                
    $("#revForm").submit(function(event) {  
    event.preventDefault();
    alert("submitted Line 142");  **<<============= this does nothing !**
    }) // submit 
            
}) // ready
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!