I haven't seen this exact question addressed...if it has been, just please point me to it.
I'm using jquery's ui tooltip. I have one link that when you mouseover it, I'd like to show an image. Nothing has worked for me so far.
ui code in header:
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.1/themes/base/jquery-ui.css" />
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="http://code.jquery.com/ui/1.10.1/jquery-ui.js"></script>
HTML:
(see <a id='riverroad' href='#' title='' >image of 1 Maple St.</a>)
code:
$( "#riverroad" ).tooltip({ content: "<img src='./images/myimage.jpg/>" });
Please tell me what I'm doing wrong.
Just pass the HTML content directly in title and you'll be fine.
Just remember to use single quotes inside title.
First, you are missing the closing quote of your
src
tag. Your code should be :Moreover, this should be working with the following code as shown on jQueryUI's website :
HTML :
JS :
Here is a demo on jsFiddle : http://jsfiddle.net/QgPEw/1/
try this one :
Html
JQuery
See the working fiddle.
Jquery 1.9.1 and JqueryUI 1.9.2 are included of course. Check if your image path is correct by the way.
Edit : You told me that you're setting the link with jQuery, see this second working example :
Html
JQuery
Here is the new fiddle !