在键盘上输入按钮刷新而不是提交 [英] Enter button on Keyboard refreshes rather than submitting
本文介绍了在键盘上输入按钮刷新而不是提交的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用以下html
< input type =buttonvalue =GetonClick =get ();>
get();它是一些早些时候使用javascript
声明的函数
我知道输入类型是否可以提交,但是如何让它适用于以下内容?
在钥匙板上输入。
获取函数
function get(){
$ .post('ass.php',{name:form.name.value},
函数(输出){
$('#age')。html(输出).show();
});
}
解决方案
你在做什么违反标准: http://www.w3.org/wiki/HTML/Elements / input / button 按钮状态表示一个没有默认行为的按钮。
唯一的解决方案是使用适当的按钮代码来捕获keyPress动作。
I am using the following html
<input type="button" value="Get" onClick="get();">
get(); it is some function declared earlier using javascript
I know if the input type is submit it works, but how to make it work for the following?
Enter on Key Board.
get function
function get() {
$.post('ass.php', { name: form.name.value },
function(output){
$('#age').html(output).show();
});
}
解决方案
What are you trying to do is against standards: http://www.w3.org/wiki/HTML/Elements/input/button "The button state represents a button with no default behavior."
The only solution is to catch keyPress action, with appropriate button code.
这篇关于在键盘上输入按钮刷新而不是提交的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文