Details on pre-binding and post-binding in js _ basic knowledge

Source: Internet
Author: User
This article details the pre-binding and post-binding in js. If you have any need, you can refer to it. The main meaning is that I have not used pre-binding, that is, when some elements in the Dom tree have not yet been created, it specifies certain events that should be owned by elements of this type as soon as they are born. In actual development, pre-binding and post-binding are often involved. As the name suggests, some events are bound before the binding -- before being born, and only after the binding -- after birth.
The following is a simple example for your reference and comparison of each method:
Page elements:

The Code is as follows:



Aaaaaaaaaaaaaaaaaaaaaa

Bbbbbbbbbbbbbbbbbbbbbb

Ccccccccccccccccccccccc

Dddddddddddddddddddd

Eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee

Fffffffffffffffffffffffffffffffffff

Gggggggggggggggggggg

Hhhhhhhhhhhhhhhhhhhhhh




Js in the page:

The Code is as follows:


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.