1

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?

1
  • There is an easier way to format code (edit and see). BTW you really shouldn't be defining the onmousemove event in your markup. Instead: $(function() { $("#mon_Row").mousemove(calculate_Time); }. Commented Apr 24, 2010 at 2:42

1 Answer 1

3

Simplest answer: Don't redo what has already been done and done well. Both support callbacks that can be used to modify the text being displayed.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.