On this page

        .off()

        This method is used to unbind event or gesture handlers previously bound to an element using .on().

        Syntax

        // Unbind all listeners bound to the following event name
        // regardless of the event handler
        $(el).off(eventName);
        
        // Unbind the listener bound with the following event handler  
        $(el).off(eventName, originalHandler);
        
        // Unbind the listener bound with the following event handler and tag 
        $(el).off(eventName, originalHandler, {tags:[...originalTags]});
        
        // Unbind the listener bound with the following tag 
        // regardless of the event handler
        $(el).off(eventName, null, {tags:[...originalTags]});

        Parameters

        • eventName: String - The event or gesture name.
        • originalHandler: Function - The handler function originally used with .on().
        • params: Object - Additional parameters.

        Return

        • this - The Play UI instance.

        Usage

        Unbind a specific listener bound to doubletap.

        $(document.body).off('doubletap', originalHandler);

        Unbind all listeners bound to doubletap.

        $(document.body).off('doubletap');

        Matching By Tags

        The params.tags parameter can be used to match listeners that were tagged by the .on() method.

        $(el).off(eventName, originalHandler, {tags:['#tag']});

        Static Usage

        The .off() instance method is internally based on the standalone ui/off() function which may be used statically.

        Import

        const { off } = $.ui;
        import { off } from '@webqit/playui-js/src/ui/index.js';

        Syntax

        See the general way to use Play UI's standalone functions