How to make input field readonly (suppress mobile keyboard)?

Hello all,

I am trying to make the input fields within my scene be “readonly” because I do not want the mobile keyboard to pop-up when the input field is clicked/touched. I am coding a number keypad within the scene to populate the input fields instead.

Here is the scene

https://launch.playcanvas.com/1622617?debug=true

In the script attached to the image entity, the input is initialized with the first line of code. From my initial google search it appeared that a document input could be set to readonly to achieve what I am after. I am just stuck on how to do this in playcanvas. I tried the second line of code but no use.

Thanks in advance for any help.

this.element = document.createElement('input');

//error that attributes is not a function
this.element.attributes('readonly','readonly');

Hi @hooymana,

Can you try, just in case this way instead:

this.element.readOnly = true;
1 Like

Hi @Leonidas

That worked! Thanks!

1 Like