Search code examples
jqueryhtmlasp.net-mvctooltip

Show Tooltip inside div


I have few menu , i am showing them in left navigation bar

 <li><a href= @RoleGroup><i class="menu-icon fa fa-users"></i> <span class="title"> Group Management</span></a></li>

I want to show Tooltip (4-5 lines) on mouse over inside a div. In above code how i can place tooltip inside div with good css style.

Thanks.


Solution

  • Are you trying to make the text of the element you're hovering over display in another div? We'd need more code to really get this but here's a start:

    $('.ulClass li').mouseover(function(){
         var myText = $(this).text();
         $(divIwantTextToShowIn).text(myText);
     });
    
    $('.ulClass li').mouseleave(function(){
    
         $(divIwantTextToShowIn).text("");
     });
    

    That will display the text from the li that you hover over in another div. I'm guessing that is what you're looking for. When the mouse cursor leaves the li it will clear the text of the div.