JavaScript prevents the carriage return from submitting a form. It is a javascript form.

Source: Internet
Author: User

JavaScript prevents the carriage return from submitting a form. It is a javascript form.

You should be familiar with the function of the Enter key. For example, in many applications of windows, you only need to click the Enter key to enter the program or enable a function, however, sometimes we want to block its functions. For example, when entering a form, you may accidentally click the Enter key to incorrectly submit the form. The following describes how to implement this function. The code example is as follows:

How to Prevent the enter key from submitting a form is actually very simple. Onkeydown = "if (event. keyCode = 13) return false;" write this sentence in the from tag.

<! DOCTYPE html> 

The code above can block the function of clicking enter to submit a form. The code is simple and easy to understand. If you have any questions, please give us your valuable comments. Thank you for your support for the help House website.

Articles you may be interested in:
  • Js Code of the form submitted without the form
  • Question about form submission triggered by the javascript enter key
  • Js press enter to submit forms.
  • Example code of js disabling carriage return for form submission
  • Summary of the method for submitting the form of the Return key using javascript
  • Js cursor location text box carriage return form submission Solution

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.