问题
In my application I have a line drawn from one table cell to another cell through jQuery SVG plugin. Following the steps of the blog post http://www.openstudio.fr/Library-for-simple-drawing-with.html I managed to add it. But at the same time I need to remove that line and draw it on another place when mouse hovers. Is there a method to remove the drawn line or should I follow a different methodology to hide it or remove it ? Any help is highly appreciated.
回答1:
According to the documentation the line function returns an svg <line>
element, so you should be able to remove it using the standard DOM core method removeChild()
.
Untested, but hopefully working:
var myline = svg.line(parent, x1, y1, x2, y2, settings);
parent.removeChild(myline);
来源:https://stackoverflow.com/questions/2368492/jquery-remove-drawn-line-added-via-jquery-svg-library