Textarea提交回车 [英] Textarea submit with enter
本文介绍了Textarea提交回车的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个表格。当你点击回车按钮。表格正在提交。但是现在我有一个问题。当我在textarea中输入按钮时。然后表单将提交。但在textarea,输入必须是输入。
I have a form. When you hit the enter button. The form is going submit. But now i have a problem. When i hit the enter button in the textarea. Then the form is going submit. But in a textarea, a enter must be a enter.
我该如何解决这个问题?这是我的代码:
How can i fix this? This is my code:
form.keypress(function(e) {
if (e.which == enter) {
e.preventDefault();
$(this).find('[type=submit]').click();
}
});
推荐答案
试试这个
form.submit(function(e) {
e.preventDefault();
$(this).find('[type=submit]').click();
$("form").submit();
})
这篇关于Textarea提交回车的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文