I saw this on stackoverflow which works
a = document.createElement("a")
linkText = document.createTextNode("my title text")
a.appendChild linkText
a.title = "my title text"
a.href = "http://example.com"
document.body.appendChild a
I need something similar but my problem is that I'm using charts from here:
and I need the title of the chart to be a hyperlink!
In my coffeescript I have the following:
p5 = new JustGage(
id: p["name"]
value: p["value"]
min: 0
max: 100
title: (p["name"]).link p["url"] # My problem is here
)
Right now this is what I see: attached an image:
<a href='http://www.google.com'>test</a>
Thank you!!
You can't do it without modifying the library code. The relevant line would be 561, just add a href
property there (see Raphael Element.attr
for docs). Then make an additional parameter for the constructor function that allows you to pass arbitrary values.
If you don't want to do that, just omit the title and place a normal link above the drawing.