0

My code is

<script type="text/javascript" src="http://code.jquery.com/jquery-1.7.0.min.js"></script>
<script type="text/javascript" src="../../_js/jquery.tooltipster.min.js"></script>
<link rel="stylesheet" href="/resources/demos/style.css"> 
<script>
    $(document).ready(function () {
        $('#HHH').tooltipster({
            content: $('#BTE' )
        })
    })
</script>

My div is <div id="BTE">ABCDEFG</div> and <div id="HHH"></DIV>

I want to hide my "BTE" initially and when hover AROUND "hhh", the "bte" should appear. I wonder how to achieve that? I had tried display:none but it doesn't work.

Beauvais
  • 2,149
  • 4
  • 28
  • 63
user3344443
  • 475
  • 2
  • 11
  • 29

4 Answers4

1

If you dont want to use any plugins, try like this,

// Initially hide the tooltip <div>
$("#HHH").hide();

// On mouse-over add some CSS and show the tooltip <div>
$("#BTE").mousemove(function (e) {
    $("#HHH").css("top", e.pageY);
    $("#HHH").css("margin-left", e.pageX);
    $("#HHH").show();
});

// On mouse-out hide the tooltip <div> again
$("#BTE").mouseout(function () {
    $("#HHH").hide();
});

Demo

Beauvais
  • 2,149
  • 4
  • 28
  • 63
Anoop Joshi P
  • 25,373
  • 8
  • 32
  • 53
0

Try like this: I analysed the plugin and put the solution for your issue. thanks

$(document).ready(function() {
    $('#HHH').tooltipster({
        content: $('<div id="BTE">ABCDEFG</div>')
    });
});


<div id="HHH"> 
    This div has a tooltip with HTML when you hover over it!
</div>
Sudharsan S
  • 15,336
  • 3
  • 31
  • 49