I have a SVG document that contains a group that looks like this:
<g xml:id="id10883">
<textArea fill="#ffffff" xml:id="id1900" xml:space="preserve">[SPX][departure]</textArea>
</g>
[SPX][departure] is replaced on runtime by appropriate values from a JavaScript map. How could I input similar data as a fill value, e.g.
<g xml:id="id10883">
<textArea fill="[SPX][color]" xml:id="id1900" xml:space="preserve">[SPX][departure]</textArea>
</g>
Why don’t you just add a class to the element(s) instead?
Then you could simply do the following:
If you want to keep your placeholder
[SPX][color]though, you could do something like this:Note that this code isn’t really that efficient as it iterates over all DOM elements. So you should change that depending on your existing code (e.g. only get
textAreaelements…).