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.
Try the following:
var Button1 = document.getElementById("mybutton");
//Set Button Text
Button1.text = "New Text";Let me know if you have any issues.
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.
Best AnswerTry the following:
var Button1 = document.getElementById("mybutton");
//Set Button Text
Button1.text = "New Text";Let me know if you have any issues.