New course! Every coder should learn Generative AI!
Try a free lesson+ 6
DOM attributes for SVG Doesnt work, why? And how to fix it?
Assuming that <rect x="0" y="0" .../> exists inside <svg>. And <textarea> and <button onclick = "submit;"> too. ... means other attributes The js code: function submit(){ var p = document.getElementById("player"); var input = document.getElementById("input").value; var py = p.top.toString().replace("px", ''); var px = p.left.toString().replace("px", ''); console.log("px = "+px+"; py = "+py) for(var node in input){ var node = input[node]; if (node == ">"){ p.left = parseInt(px) + parseInt("250"); console.log(p.x); } } } Assuming this code above would word somehow. And it made an error, just giving me [SVGAnimationLength]. Why? And how to fix it?
2 Answers
+ 1
// see my code for move elements inside SVG
https://code.sololearn.com/WBlYiLMrR7xY/#html
0
Please show all the code!