Get tooltip content from url in javascript

I am using cluetip for tooltips in my website and I want to set the tooltip text based on the url of the link,

For example: I have a link on my page at "http: abc.com/display? Content = sweeties" and I want the tooltip to read "sweeties"

Will someone show me please

0


a source to share


3 answers


You should title your link to "sweets" and then instruct any tooltiping plugin to use the title attribute for the content.



I think it could work with cluetip out of the box.

+1


a source


var a = $("aTagsId");
var content = a.attr('href').match(/content\=([^\&]*)/)[1];
a.attr('title', content);
... setup cluetip w/ title...

      



0


a source


One undocumented, nice and quick way to do this is to use a function as the first argument in a cluetip call that returns the content you want:

var normalcluetipsettings = {.. ... ... ... }
$('#mydiv').cluetip(function(){return 'hello'+' '+'world';}, normalcluetipsettings)

      

0


a source







All Articles