10-21-2017 09:54
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

10-21-2017 09:54
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
- Who Voted for this post?
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.
Accepted Solutions
11-01-2017 09:08
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

11-01-2017 09:08
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
- Who Voted for this post?
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
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post


10-21-2017 11:16
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

10-21-2017 11:16
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
I have a reference to the button element, but you can't set innerText on the element.

11-01-2017 09:08
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

11-01-2017 09:08
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
- Who Voted for this post?
Try the following:
var Button1 = document.getElementById("mybutton"); //Set Button Text Button1.text = "New Text";
Let me know if you have any issues.
