What's the best solution for adding tooltip to <rect>
?
I've created SVG map with several <rect>
tags and I'd like to show tooltip on mouseover. Using title
attribute is fine but is there any option how to restyle it using CSS/Javascript/jQuery or is there even better option for adding tooltip?
<svg version="1.1" baseProfile="basic" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 50 50" xml:space="preserve">
<g>
<rect id="1" title="There's some text" x="0" y="0" fill="#666666" width="20" height="20"/>
<rect id="2" title="There's another text" x="30" y="0" fill="#666666" width="20" height="20"/>
</g>
</svg>