[英]Form submit by enter key except in textarea in javascript?
I have this form where it submits by pressing enter key. 我有此表单,可以通过按Enter键提交。
I want it to function except for textarea, where it should has it usual behavior adding a new line in text-area 我希望它除textarea以外起作用,它应该具有通常的行为,在textarea中添加新行
The default behavior is that the form doesn't submit if you press enter inside a textarea as seen in the following live demo . 默认行为是,如果您在文本区域内按Enter键,则不提交表单,如以下实时演示所示 。 It simply adds a new row inside the textarea.
它只是在文本区域内添加了新行。 You don't need any javascript for this.
您不需要任何JavaScript。 On the other hand if the the user presses enter while inside a normal textbox the form is submitted.
另一方面,如果用户在普通文本框内按下Enter键,则提交表单。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.