A-entity text, set text per js and keep text format

Hello
I try to represent a text that I change per js.
Therefore I have created an entity:

now I want to change the text via javascript, but I don’t know how?

can someone please help me?

thank you very much

Hi there,
This should be moved to #coding-help

1 Like

Hey @svenessar,

Are you trying to change the text of a HTML element using JavaScript?

i try to change the text displayed in vr. so yes :-/

For an <a-entity>?

yes,
<a-entity id="TestText" text="side: double; tabSize: 4.32; value: Lorem ipsum dolor sit amet, consetetur sadipscing elitr"></a-entity>

and i used no text because it is not visible from behind :frowning:

Try this:

let textValue = 'Lorem ipsum dolor sit amet, consetetur sadipscing elitr';
let textEntity = document.getElementById("TestText");

let entityValue = 'side: double; tabSize: 4.32; value: ' + value;

textEntity.setAtrribute('text', entityValue);

it works… but not complete

document.getElementById(“TestText”).setAttribute(“text”, ‘side: double; tabSize: 4.32; value:’ + atob(“ZnVuY3Rpb24gVmlld0RpZEFwcGVhcihib29sIGFuaW1hdGVkKQoKICAgIHsKCiAgICAgICAgdmFyIG8gPSBuZXcgQWR2YW5jZWRDb2xvclBpY2tlcigpOwoKICAgICAgICB0aGlzLlByZXNlbnQobywgZmFsc2UsIG51bGwpOwoKICAgfQ==”))

it should display:

    function ViewDidAppear(bool animated)

    {

        var o = new AdvancedColorPicker();

        this.Present(o, false, null);

   }

i can do what i want, my format will be destroyed… i could cry