The form is not submitted until the trigger function returns true before the form is submitted
- 2020-03-30 02:20:51
- OfStack
Look at the code
The onsubmit function in the example is the function that fires before the form is submitted
The form will only be submitted if it returns true, otherwise it will not be submitted
<form id="payForm" action="yeepaypay.html" target="_blank" method="post" onsubmit="return checkform();">
The onsubmit function in the example is the function that fires before the form is submitted
function checkform() {
var value = $("input[name='payWay']:checked").val();
if (value == 1) {
$("#alipayment").submit();
return false;
}
return true;
}
The form will only be submitted if it returns true, otherwise it will not be submitted