如何隐藏图表上的日期
<div class="highcharts-container" id="highcharts-6">
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="1330" height="532"><desc>Created with Highstock 1.3.7</desc><defs><clipPath id="highcharts-7"><rect fill="none" x="0" y="0" width="1239" height="290"></rect></clipPath></defs>
<path fill="none" d="M 71 45 L 71 335 180 335 180 45" zIndex="5"></path>
<text x="126" y="29" transform="translate(0,0)" visibility="visible">
<tspan x="126">7/9/15</tspan></text></svg></div>
最佳答案
如果只有一个,那么这段代码应该可以工作:
document.querySelector("tspan").style.display = "none";
如果有多个则:
[].forEach.call(document.querySelectorAll("tspan"), function(item) {
item.style.display = "none";
});
或者如果你想使用 jQuery:
$("tspan").hide();
关于javascript - 如何使用javascript隐藏元素,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32336063/