Search code examples
javascriptjqueryhtmljspqtip2

How to show the title with qTip2 and jQuery with .hover function?


I am trying to set a title in my element at my JSP page using qTip2 and jQuery with a .hover function.

Code:

$(document).ready(function() {
    $('#send').qtip({
        content: {
            title: 'My Title'
        }
    });
});   

the "send" is a button and I am trying to hover the mouse and get a message with the title.


Solution

  • Ok, I got the answer here.

    Add the CSS:

    <link rel="stylesheet" href="css/jquery.qtip.min.css">
    

    Add the libraries:

    <script src="jquery/jquery-1.11.2.min.js"></script>
    <script src="jquery/jquery.qtip.min.js"></script>
    

    And the script:

    $(document).ready(function() {
        alert('a');
        $('#send').qtip({ // Grab some elements to apply the tooltip to
          content: {
             text: 'My common piece of text here'
         }
        });  
    });