raphaelgraphael

get graphel barchart label value onlick in javascript


I am trying to get the value of the clicked text from a barchart built with graphael library. I am using a function to create the labels for the barchart and here is the text part:

l= a.text(x, y, labels[i]).attr({ font: "20px Helvetica" , cursor: "pointer" }).click(function () {
 $document.getElementByTagName('tspan').value; 

});


Solution

  • I was able to solve this using the target property from the mouseEvent.

    $(event.target).text();