Home > Web Front-end > HTML Tutorial > How to submit when the input to be submitted in the form is type='button'? _html/css_WEB-ITnose

How to submit when the input to be submitted in the form is type='button'? _html/css_WEB-ITnose

WBOY
Release: 2016-06-24 11:39:05
Original
1200 people have browsed it

How to submit the form with input type="button"?

<form action="#" method="POST"><input type="button" value="这是提交的内容"><input type="submit" value="提交"></form>
Copy after login


Reply to the discussion (solution)

By the way, there is also

<form action="#" method="POST"><input type="submit" value="提交"></form>
Copy after login
how to submit the value of the input itself: "Submit "?

Add name attribute


<form action="#" method="POST" id="inputForm"><input type="button" value="这是提交的内容"><input type="submit" onclick="checksubmit()" value="提交"></form>
Copy after login

Controlled through js:
function checksubmit(){     $("#inputForm").submit();//jquery方式.     //document.getElementById("inputForm").submit();原生js方式,未测试.}
Copy after login

Add the name attribute so that the background can recognize it. Or submit using ajax

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