+ 1

Appending child

Why can't I append "line" to "svg"? https://code.sololearn.com/WEwrgyrjOQS6/?ref=app

6th Oct 2017, 2:34 PM
Tom2003611
Tom2003611 - avatar
4 Answers
+ 4
To manipulate SVG commands on JavaScript, one must use the svg <script> element
6th Oct 2017, 2:57 PM
Nomeh Uchenna Gabriel
Nomeh Uchenna Gabriel - avatar
+ 4
svg uses a namespace. Use document.createElementNS(): https://stackoverflow.com/a/16489845 I use it in [JS] line 80 here: https://code.sololearn.com/WKLubPzanpv8/?ref=app
6th Oct 2017, 2:59 PM
Kirk Schafer
Kirk Schafer - avatar
+ 4
Try this instead var line = document.createElementNS("http://www.w3.org/2000/svg", 'line');
6th Oct 2017, 2:59 PM
CalviÕ²
CalviÕ² - avatar
+ 3
You can! Just that it's an object, thus that display
6th Oct 2017, 2:54 PM
šŸ‘‘ Prometheus šŸ‡øšŸ‡¬
šŸ‘‘ Prometheus šŸ‡øšŸ‡¬ - avatar