Only numbers can be entered into the Text Entry object

I want to limit the Text Entry object to only allow numbers to be entered. What should I do for this? @QuynhAnh_Vu @Hang

Hi Cemile,

Please add the following JavaScript code to the On Load event of the slide to achieve that:

var textInput = prez.object('name').textNode;
$(textInput).attr({type: 'number'});

Regards,

1 Like

Thanks for your help, Hang

1 Like

Hi Hang,

Thank you for the previous code snippet regarding changing the input type to "number" for standard text inputs.

I’m currently working with Fill-in-the-Blanks interactions, and I would like to make all the input fields inside a fill-in-the-blanks question accept only numbers (i.e., change their type to "number").

Could you please let me know how to correctly target and modify all these internal input fields—especially when using prez.object(...) on a fill-in-the-blanks question?

Looking forward to your guidance.

Best regards,