Numeric field width when using numeric keyboard on mobile | XM Community
Skip to main content
Solved

Numeric field width when using numeric keyboard on mobile

  • September 13, 2019
  • 2 replies
  • 54 views

Forum|alt.badge.img+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? !

Best answer by TomG

Set max-width: ``` jQuery("#"+this.questionId+" .InputText").css("max-width","2em"); ```

2 replies

  • September 13, 2019
if you add jQuery("#"+this.questionId+" .InputText").attr('style', 'width:60px') it should solve this.

TomG
Level 8 ●●●●●●●●
Forum|alt.badge.img+27
  • Level 8 ●●●●●●●●
  • Answer
  • September 14, 2019
Set max-width: ``` jQuery("#"+this.questionId+" .InputText").css("max-width","2em"); ```