I need to fulfill a strange requirement that looks like this:
- Users can hover over a link and receive descriptive text, such as "text here."
- Users can click on the same link and get completely different text, which may also contain markup (Example: some other text here)
I looked at some jQuery plugins, but most of them work with onhover OR onclick, but not both. They also seem to be using the "title" attribute for their content.
So my question is: is this functionality possible? Is there a jQuery tooltip plugin where I can define other content for onhover and onclick events? Is there any other way to achieve this? (Javascript is not one of my strengths).
I also open suggestions for simple stand-alone javascript libraries, but it would be better if they are jQuery plugins.
Thank.
Answer:
Using simpletip
HTML code
<p>Hello <a id="test" title="some text here">world</a> again</p>
and javascript
$("#test").simpletip({
persistent: true,
content: '<b>Some</b> other <i>text</i> here.'
});
source
share