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: