DOM attributes for SVG Doesnt work, why? And how to fix it? | Sololearn: Learn to code for FREE!
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?

31st Oct 2019, 10:05 AM
Name Omitted until I come back
2 Answers
+ 1
// see my code for move elements inside SVG https://code.sololearn.com/WBlYiLMrR7xY/#html
1st Nov 2019, 5:52 PM
Jônatas Araripe
Jônatas Araripe - avatar
0
Please show all the code!
1st Nov 2019, 4:52 PM
Jônatas Araripe
Jônatas Araripe - avatar