You will recieve your password to this address. Address is not made public.

Your preferred username that is used when logging in.

dynamically inserting tooltip Created Mar 16, 2010

This thread is solved

Views: 1425     Replies: 2     Last reply Mar 17, 2010  
You must login first before you can use this feature

bufisoft

Posts: 3

Registered:
Mar 16, 2010

dynamically inserting tooltip

Posted: Mar 16, 2010

Is it possible dynamically insert tooltip? I was trying to do that but it isnt working. Thank you for answers. Here is my code:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns=http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script src=http://cdn.jquerytools.org/1.1.2/jquery.tools.min.js"></script>
<script>
$(document).ready(function() {
$("#demo a[title]").tooltip('#demotip');
});

function loadAnnotations(){

var b = document.createElement('a');
b.setAttribute("title", "content");
b.innerHTML = "word";
var node=document.getElementById("pointer");
node.appendChild(b);
}
</script>
<style>
#demotip {
display:none;
background-color:#009966;
font-size:12px;

padding:25px;
color:#FFFFFF;

}
</style>
</head>

<body onload="loadAnnotations();">
<br>
<br>
<br>
<br>
<br>
<br>
<!-- the tooltip -->
<!-- and the triggers -->
<div id="demo">
<div id="pointer"></div>
</div>
<div id="demotip"> </div>
</body>
</html>

jpsimmons

Posts: 9

Registered:
Feb 25, 2010

» dynamically inserting tooltip

Posted: Mar 16, 2010

Reply to: dynamically inserting tooltip, from bufisoft
First you are missing a quote in your script declaration which is throwing an error because it can't find jquery (do you use firebug with firefox? if not i suggest getting it..)

Next it seems like with the different onload and ready events you are just setting yourself up for hard times. Why not make it a little bit more obvious in your document.ready function?


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script src="http://cdn.jquerytools.org/1.1.2/jquery.tools.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
loadAnnotations();
$("#demo a[title]").tooltip('#demotip');
});

function loadAnnotations(){
var b = document.createElement('a');
b.setAttribute("title", "content");
b.innerHTML = "word";
var node=document.getElementById("pointer");
node.appendChild(b);
}
</script>
<style>
#demotip {
display:none;
background-color:#009966;
font-size:12px;

padding:25px;
color:#FFFFFF;

}
</style>
</head>

<body> 
<br>
<br>

<br>
<br>
<br>
<br>
<!-- the tooltip -->
<!-- and the triggers -->
<div id="demo">
<div id="pointer"></div>
</div>
<div id="demotip"> </div>
</body>
</html> 


bufisoft

Posts: 3

Registered:
Mar 16, 2010

» » dynamically inserting tooltip

Posted: Mar 17, 2010

Reply to: » dynamically inserting tooltip, from jpsimmons
thank you very very much:)