0

The code works to change the background color.

regionLinks[i].style.backgroundColor = (regionRow === selection[0].row) ? '#ff7700' : null

But I want to change the text color instead of the background color. How can I do that? The html that is manipulated is

'<div data-row="' + i + '"><a class="region" href="/' + data.getValue(i, 0) + '">' + data.getValue(i, 0) + '</a></div>'

My aim is to make the text in the link have the new text color at this change.

2 Answers 2

1

The style property is called color

regionLinks[i].style.color
Sign up to request clarification or add additional context in comments.

Comments

1

The color is the property for text color.

If regionLinks[i] is the anchor then regionLinks[i].style.color = '#123456';
if it is the div regionLinks[i].firstChild.style.color = '#123456';

Anchors are styled by the UA, so to overwrite them you have to target it specifically.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.