我想如何将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"/>

最佳答案

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>

07-24 21:58