View Full Version : Using the jquery tooltip with a conditional

03-11-2011, 02:38 AM

I'm working on a series of pages which have quizzes involved with them. For most of them, I'm printing a response right next to the question(:Correct" or one of several possible wrong answer responses) using the following code (integrated with a larger swath of javascript):

function {checkAnswer(obj,answers,wrong_answers)
{obj.nextSibling.innerHTML = (obj.value == answers[obj.qNum])? 'Correct!' : wrong_answers[obj.qNum];

It works great except for the fact that some of my "questions" are single textboxes integrated into the text around it. I'm hoping to find an elegant way to show the appropriate message. Would the jquery tooltip be a possibility? In other words, can it be used so that one it pops up right next to the textbox within the context of my "checkAnswer" function? If not, if you have any other elegant solutions to this issue, I'd appreciate your thoughts.

Thank you,