aframe-gui icon indicating copy to clipboard operation
aframe-gui copied to clipboard

Can't change the value of an a-gui-button programatically

Open mdubourg001 opened this issue 6 years ago • 3 comments

I have a button in my index.html:

<a-gui-button id="button" value="Hello"></a-gui-button>

Trying to change its value as following has no effect:

const button = document.querySelector('#button');
button.setAttribute('value', 'Goodbye');

Edit: The actual workaround I'm using it to put a custom text component (<a-entity text="" />) inside the button and edit it when I need.

mdubourg001 avatar Oct 23 '19 12:10 mdubourg001

@mdubourg001 can you post a snippet using a-entity with a-gui-button? I can't get the entity text to display

davidfstein avatar Dec 14 '19 21:12 davidfstein

Hello guys, I saw this problem when I was trying to use the button component. I opened this pull request to fix this problem. Now it's just wait for some review.

jfilipedias avatar Sep 03 '20 22:09 jfilipedias

Thanks, this works for me and can even bind to it using aframe-state component.

levexis avatar Jan 24 '21 10:01 levexis