Rookie Learn JS (four)--javascript for the button to register the return event (set the default button)

Source: Internet
Author: User

Have to say, in the JS aspect, oneself really is a genuine rookie. For JS and some JS framework such as jquery JS frame, oneself is just in the stage of simple application, of course, oneself also in continuous learning, hope in the future can share with you more JS experience. Let's start with an appetizer today. How to set a default button, that is, whether the focus is not on the button, just press ENTER, it is equal to trigger the button click event.


The code is very simple, just a few lines of code to complete this function:


Well, it seems a little too simple, so complete a blog, I am a little embarrassed. Finally, we enclose an example of a small program:

<! DOCTYPE html>


This small example is very simple, the code is very understood, but the thing behind the code is not common people can understand. Please raise your hand if you can understand.




Rookie Learn JS (four)--javascript for the button to register the return event (set the default button)

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.