Regarding JQuery custom events, many people have sent emails asking me if I will use them in my daily JavaScript applications, as well as specific examples of cloud computing... I happen to be responsible for the development of a visual editor recently, some of which facilitate the application of JQuery custom events, and achieved good results-streamlined Code while fully utilizing the OO principle.
This article uses an example I encountered in the actual application development process to further illustrate "when to use JQuery custom events and how to use them, at the same time, you should reply to emails from students.
Demo-Ingenious JQuery custom event
JQuery best practices-Exquisite custom events
Q: How can you easily trigger the processing logic of the click Event of a check box X without changing its current selected status?
Answer: Use a Custom Event Handler function to encapsulate the processing logic of the checkbox click event! Then, the Custom Event is triggered.
Have you ever encountered the following application scenarios?
Requirement: If A container is A, can you set whether or not the four borders of A container have their border color? "Whether or not the border" and "color change" need to be linked,
That is to say, the current set color is obtained when the border is changed, the current set border is obtained when the color is changed, and timely reflected on container.
Note: In this example, the border color is set in a uniform way. You can write down the examples for setting them separately ~
Core code:
The Code is as follows:
Border settings:
Upper
Right
Lower
Left