Skip to content

Instantly share code, notes, and snippets.

@slackorama
Created June 24, 2009 19:35
Show Gist options
  • Save slackorama/135467 to your computer and use it in GitHub Desktop.
Save slackorama/135467 to your computer and use it in GitHub Desktop.
change a tooltip text programatically
<html>
<head>
<title>Tooltip Demo</title>
<style type="text/css">
@import "http://ajax.googleapis.com/ajax/libs/dojo/1.3/dojo/resources/dojo.css";
@import "http://ajax.googleapis.com/ajax/libs/dojo/1.3/dijit/themes/tundra/tundra.css";
</style>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/dojo/1.3/dojo/dojo.xd.js"
djConfig="parseOnLoad: true"></script>
<script type="text/javascript">
dojo.require("dojo.parser");
dojo.require("dijit.Tooltip");
dojo.require("dijit.form.Button");
</script>
<script type="text/javascript">
function changeTooltip(){
dijit.byId('divId1').attr('label','This is the changed tooltip for id1');
dijit.byId('divId1').attr('label','This is the changed tooltip for id2');
}
dojo.addOnLoad( function() {
dojo.connect(dojo.byId('buttonId'),'onclick',changeTooltip);
});
</script>
</head>
<body class="tundra">
<span id="site1">Tooltip1</span>
<div id="divId1" dojoType="dijit.Tooltip" connectId="site1" label="This is the tooltip for id tip1">
</div><br>
<span id="site2">Tooltip2</span>
<div id="divId2" dojoType="dijit.Tooltip" connectId="site2" label="This is the tooltip for id tip2">
</div>
<br>
<button id="buttonId" dojoType="dijit.form.Button">Button</button>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment