如何在不提交onclick的情况下将值提交给javascript [英] How can I submit value to javascript without submitting onclick
问题描述
如何在不提交我的onclick按钮的情况下将输入值提交给javascript函数?这里是代码:
How can I submit an input value to a javascript function without submitting my onclick button? Here is the code:
<input id="demo" type="text" value="1">
我希望能够将值提交给JavaScript,这里是代码:
I want to be able to submit the value to a javascript here is the code:
function myFunction() {
var x = document.getElementById("demo").value;
基本上我想提交我的输入值而没有提交按钮。这里是代码:
Basically i want to submit my input value without having my submit button. Here is the code:
<input id="demo" type="text">
<button type="button" onclick="myFunction()">Test</button>
如何在不提交提交按钮的情况下提交我的输入
<
How can I submit my input without having a submit button?
解决方案
推荐答案
url.php>
< input type =textvalue =some valuename =name_input/>
< / form>
<form action="url.php">
<input type="text" value="some value" name="name_input" />
</form>
只有您可以在name_input字段中按ENTER键发送表单数据
Only you can press ENTER in "name_input" field for send the form data
这篇关于如何在不提交onclick的情况下将值提交给javascript的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!