Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8646115
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T12:43:15+00:00 2026-06-12T12:43:15+00:00

I have a SVG document that contains a group that looks like this: <g

  • 0

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>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T12:43:16+00:00Added an answer on June 12, 2026 at 12:43 pm

    Why don’t you just add a class to the element(s) instead?

    <g xml:id="id10883">
        <textArea class="spx_color" xml:id="id1900" xml:space="preserve">[SPX][departure]</textArea>
    </g>
    

    Then you could simply do the following:

    var spx_color = document.getElementsByClassName("spx_color");
    for (var i = 0, l = spx_color.length; i < l; ++i) {
        spx_color[i].setAttribute("fill", "#ffffff");
    }
    

    If you want to keep your placeholder [SPX][color] though, you could do something like this:

    var elements = document.getElementsByTagName("*");
    for (var i = 0, l = elements.length; i < l; ++i) {
        if (elements[i].getAttribute("fill") == "[SPX][color]") {
            elements[i].setAttribute("fill", "#ffffff");
        }
    }
    

    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 textArea elements…).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an SVG element inside HTML document that I'd like to export as
I have some SVG files that I'd like to create a PDF with. For
I have this svg: <circle cx=50 cy=100 r=50 stroke-width=0 fill=orange/> <polygon points=0,100, 50,50 100,100
I have an SVG that I will add elements to. And on mousemove this
I have a web document that contains a div element. That div element contains
I have an svg group which contains some elements, I want to clone the
So I have a function like such: var elem = document.createElement( 'svg' ); elem.id
I have an SVG slider that I've been working on ... please see it
I have a SVG file that I want to extend by adding onclick handlers
I have an SVG file.This file shows the outline of cartoon character(2D character). My

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.