Home > Web Front-end > JS Tutorial > Before the form is submitted, the trigger function returns true and the form will be submitted_javascript skills

Before the form is submitted, the trigger function returns true and the form will be submitted_javascript skills

WBOY
Release: 2016-05-16 16:55:51
Original
1135 people have browsed it

Look directly at the code

Copy the code The code is as follows:



The onsubmit function in the example is the function that is triggered before the form is submitted
Copy code The code is as follows:

function checkform() {
var value = $( "input[name='payWay']:checked").val();
if (value == 1) {
$("#alipayment").submit();
return false;
}
return true;
}

The form will be submitted only if true is returned, otherwise it will not be submitted.
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template