Tooltip plugin for jQuery
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

Tooltip plugin for jQuery

What is Tooltip

Tooltip is a simple jQuery plugin for generating tooltips.


Do not use title selector as selector cause the script will remove that attribute.

$(function() {
        gravity: ['sw', 'nw', 'se', 'ne', 'n', 's', 'e', 'w']


  • gravity:

    Gravity priority used in order when tooltip falls out of bounds.

    • Type: Array or String
    • Default: ['sw', 'nw', 'se', 'ne', 'n', 's', 'e', 'w']
  • offset:

    Distance between element and tooltip

    • Type: Integer
    • Default: 5
  • titleSelector:

    The selector of the title text which will be used by the plugin.

    • Type: String
    • Default: 'title'
  • live:

    Define if the trigger event should be bound as a live event.

    • Type: Boolean
    • Default: true
  • trigger:

    Define what will trigger the tooltip.

    • Type: String
    • Default: 'hover'
  • className:

    Add class to the tooltip element on creation.

    • Type: String
    • Default: false


Functions used to manually control the tooltip element.

  • .show()

    Show the tooltip element.

  • .hide()

    Hide the tooltip element.

  • .html(text or html)

    Set the html contents for the tooltip element.

  • .addClass(string)

    Add a CSS class to the tooltip element.

  • .removeClass(string)

    Removes all or the specified class(es) from the tooltip element.

  • .setGravity(`string or array)

    Sets the gravity of the tooltip element.

To use functions you need to initialize the tooltip on the binding element first.

$('#element-id').tooltip({trigger: 'manually'});

Then call functions by parsing the first parameter as true followed by the function(s).


All functions can be nested as following.

$('#element-id').tooltip(true).html('Try this kewl jQuery tooltip plugin.').addClass('tooltip-plugin').show();


1. Fork it.
2. Make changes.
3. Create a pull request.
4. Enjoy a cup of coffee while waiting.


By forking this project you hereby grant permission for any commits to your fork to be merged back into this repository and, with attribution, be released under the terms of the MIT License.