Creating a simple JQuery tooltip?

Posted by Mike El Panther on Stack Overflow See other posts from Stack Overflow or by Mike El Panther
Published on 2010-04-24T02:36:53Z Indexed on 2010/04/24 2:43 UTC
Read the original article Hit count: 280

Filed under:
|
|

Has anybody here got any experience in creating simple tooptips using JQuery?

I have created a table:

<tr id="mon_Section">  
  <td id="day_Title">Monday</td>`    
  <td id="mon_Row" onmousemove="calculate_Time(event)"></td>
</tr>`

the function "calculate_Time" will be called and this gets the X position of the mouse cursor and from the value, uses IF and ELSE-IF statements to calculate the values of other variables i have created:

var mon_Pos; var hour; var minute; var orig; var myxpos;

function calculate_Time(event) {
  myxpos = event.pageX;
  myxpos = myxpos-194;

  if (myxpos<60) {  
    orig = myxpos;
    minute = myxpos;
    hour = 07;
  } else if (myxpos>=60 && myxpos<120) {
    orig = myxpos;
    minute=myxpos-60;
    hour=08;
  }
}

How do i go about creating a stylized tooltip containing the Hour and Minute variables that i created, I need the tooltip to be updated everytime the X position of the cursor changes. I know that with myxpos variable does change whenever the mouse is moved because i tried it out using an alert(myxpos) and as expected, if the mouse moves, a new alert box popups with a new value. I just cant work out how to place that value in a tooltip?

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about jQuery