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
WBOYOriginal
2016-06-24 11:39:051201browse

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

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


Reply to the discussion (solution)

By the way, there is also

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

Add name attribute
2f4f4d14c1b2d1279368eee403aa8548
1a8158d41b4f592c190dd221142fe988

b5b60d0e6f89b509d88376c3e981b711
42d2a595afbd6958f502978a5a9aea02

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

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

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

Statement:
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