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(" <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