Question:
I’m trying to add some step to a linear gradient tag inside an svg with js.My code works, meaning the markup is correct after the script run, but the svg is not updated/re-rendered.
I start with something like this
I’ve read some stuff about suspendRedraw, but also that is deprecated and may not apply to this case.
Does anybody has any suggestion?
Answer:
For SVG elements, you need to useDocument.createElementNS()
instead of createElement()
. The correct namespace to pass in for the first param is 'http://www.w3.org/2000/svg'
.If you have better answer, please add a comment about this, thank you!