The addMethod() function in jQuery is used to define custom validation rules, allowing developers to create validation methods tailored to their specific requirements.
3.
How can you create a promise from a deferred object in jQuery?
The promise() method creates a promise from a deferred object, allowing the deferred object to be used for chaining and managing asynchronous operations.
4.
What is the purpose of the done() method in jQuery promises?
The always() method specifies a callback that is executed regardless of whether the promise is resolved or rejected, ensuring the callback runs in all cases.
Event delegation involves attaching event handlers to parent elements, allowing events to be handled by the parent and thus applicable to current and future child elements.
Event delegation improves performance by reducing the number of event handlers, as a single handler on a parent element can manage events for multiple child elements.