Numeric field width when using numeric keyboard on mobile | XM Community
Solved

Numeric field width when using numeric keyboard on mobile

  • 13 September 2019
  • 2 replies
  • 16 views

Badge +1
Hello,
I have a question, "How old are you today?" that is set as numeric type. On mobile devices, I want the text field to bring up the telephone keyboard so it is easy to type in numbers. I currently have this in the js:

`jQuery("#"+this.questionId+" .InputText").attr('type', 'tel');`

This works - I am shown just a number keypad when I focus on this field. Problem is that the field on mobile no longer obeys the 60px width setting (desktop still shows a 60px field). I do not want a full-width field for a 2-digit input.

Can someone please help me tell Qualtrics to keep this field 60px wide?

!
icon

Best answer by TomG 14 September 2019, 04:20

View original

2 replies

if you add jQuery("#"+this.questionId+" .InputText").attr('style', 'width:60px') it should solve this.
Userlevel 7
Badge +27
Set max-width:
```
jQuery("#"+this.questionId+" .InputText").css("max-width","2em");
```

Leave a Reply