JavaScript several easy-to-click Records

Source: Internet
Author: User

1. Empty the input tag when it is worthwhile to empty it with the HTML ("") and empty it with Val ("")

2. If the event is bound more than once, the callback function executes multiple times when the event is triggered, and it is best to write the function of the binding event separately, or to unbind it every time.

3.jquery Selector If you are returning an array of jquery objects, use each to do it, or if you are working directly on the array, you may only operate on the first object of a group, and no traversal will occur.

4. Case sensitive, such as if written if. ToString () was written as ToString (), touppercase written in toUpperCase

5.document.getelementbyid (""), the arguments in parentheses remember to enclose the quotation marks

6.setTimeout ("function", time of delay); function quotes

7. The traversal of an array is best done through a for loop, not through for-in, because for ... In is much more efficient than for. There is a performance overhead when calling the array length property, so it is best to assign the length property of the array to the variable to improve performance.

8. With regard to functions, this is the most important object in JavaScript, and we can pass it as a parameter. The simplest thing to do here is settimeout, the parameter of the function call, is actually a function.

9. Sequence of execution of the program:
Program execution, from top to bottom, if you encounter alert, the browser stops there and does not continue until you click OK. If the script statement is inside the head, alert is global, it is displayed first, and then the contents inside the body are loaded. If alert is inside a function, alert will only be effective if you call the function.

JavaScript several easy-to-click Records

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.