10-21-2017 09:54
10-21-2017 09:54
How can I change the text of a button in code? I have the button displaying, but I need ot change the text in code. I have a REST call getting data, and part of the data gets the text to use on the button, I just have not found a way to reference the button's text.
<use id="mybutton" href="#square-button-icon" y="5" fill="coral">
<set href="#text" attributeName="text-buffer" to="Steps" />
</use>
Answered! Go to the Best Answer.
11-01-2017 09:08
11-01-2017 09:08
Try the following:
var Button1 = document.getElementById("mybutton");
//Set Button Text
Button1.text = "New Text";Let me know if you have any issues.
10-21-2017 11:13
Fitbit Developers oversee the SDK and API forums. We're here to answer questions about Fitbit developer tools, assist with projects, and make sure your voice is heard by the development team.
10-21-2017 11:16
10-21-2017 11:16
I have a reference to the button element, but you can't set innerText on the element.
Best Answer11-01-2017 09:08
11-01-2017 09:08
Try the following:
var Button1 = document.getElementById("mybutton");
//Set Button Text
Button1.text = "New Text";Let me know if you have any issues.