Hi, I'm just implementing a scrolling text element in which the text is dynamically set. I have it all working fine now. But for another feature, I need to get that text from the element (see below). Can anyone help me out? Thanks!
PS. I pulled this exact code from here (changing values as I needed): https://dev.fitbit.com/build/guides/user-interface/svg-components/text/#dynamic-textarea
<svg id="forecast" viewport-fill="fb-red" display="none" class="weatherInfo">
<use id="marquee" href="#marquee-text" font-size="20" width="41%"
height="21" fill="white" mode="1" value="50">
<rect width="100%" height="100%" fill="none" opacity="0.2" />
<set href="group/text" attributeName="text-buffer" />
<set href="group/separator" attributeName="width" to="50" />
</use>
</svg>
Answered! Go to the Best Answer.
Best AnswerDo you promise not to laugh at me?
marqueeEl.getElementById('group/text').textI suspect that Fitbit implemented a setter for marquee.text, but not a getter.
Of course, if you're writing to .text, you could just keep track of what you're writing. 🙂
Sadly, I've tried this already and it just returns nothing.. I'm thinking it has something to do with the HTML tags, but I'm not sure what since I'm setting the text using:
let marqueeEl = document.getElementById('marquee');
marqueeEl.text = "My data string";
And it works as intended, just not able to retrieve the text
Best AnswerDo you promise not to laugh at me?
marqueeEl.getElementById('group/text').textI suspect that Fitbit implemented a setter for marquee.text, but not a getter.
Of course, if you're writing to .text, you could just keep track of what you're writing. 🙂