路径标题显示在悬停与jquery

时间:2017-04-28 06:16:12

标签: jquery html css

我想如何使用悬停来svg路径标题节目?

        $( "path" ).click(function() {
            $("#country").val($(this).attr('title'));
            $( "#target" ).submit();
        });

某些SVG代码:

<path id="IE-CW" title="Carlow" class="land" d="M458.79,501.13L460.38,501.38L461.8,500.65L463.58,502.11L463.79,502.83L464.9L457.76,504.49L457.53,501.71L458.46,501.86z"/>

1 个答案:

答案 0 :(得分:0)

Instead of using title attribute, use a nested title element. 
Use the below code:
<path id="IE-CW" title="Carlow" class="land" d="M458.79,501.13L460.38,501.38L461.8,500.65L463.58,502.11L463.79,502.83L464.9L457.76,504.49L457.53,501.71L458.46,501.86z">
 <title>Carlow</title> 
</path>