如何通过JS动态的给SVG中的元素添加tooltip
我通过这样
$("#coalface1-path").html("<title>当前报警:12个</title>");
在谷歌浏览器生效,可以显示,但是在IE浏览器不行,不能显示提示, IE版本为11 ,求解,多谢
我通过这样
$("#coalface1-path").html("<title>当前报警:12个</title>");
在谷歌浏览器生效,可以显示,但是在IE浏览器不行,不能显示提示, IE版本为11 ,求解,多谢
<!DOCTYPE html> <html> <head> <link href="http://cdn.bootcss.com/bootstrap/4.0.0-alpha.6/css/bootstrap.css" rel="stylesheet"> <script src="http://libs.baidu.com/jquery/1.9.1/jquery.min.js"></script> </head> <body> <svg xmlns="http://www.w3.org/2000/svg"> <rect data-title="ffff" id="a" x="20" y="30" title="ddd" fill="darkorange" width="200" height="150"> </rect> </svg> <svg xmlns="http://www.w3.org/2000/svg"> <rect fill="orange" x="20" y="30" width="200" height="150"> <title>ttt</title> </rect> </svg> <script type="text/javascript"> $(document).ready( function(){ $("#a").html("<title>当前报警:12个</title>"); }); </script> </body> </html>
代码如上,多谢
举报