jQuery not only allow us to attach Event Handlers on the element it also allows to take control the flow of the events.
You can enable and disable an event whenever you want in your program.
When it’s required?
- The event is no longer needed on the element.
- Enable event when the specific condition is TRUE otherwise disables it. The most common example, of this you see on Registration page of many websites where they don’t enable click event until the user is not checked I agree on terms & conditions.
jQuery has on() and off() method that helps you to enable and disable your specific selector.