multiple choice -> text entry | XM Community
Skip to main content
Solved

multiple choice -> text entry

  • May 23, 2019
  • 1 reply
  • 9 views

Forum|alt.badge.img+3
! How to make this text box only enter a positive integer from 0 to 100? thanks a lot.

Best answer by fleb

Hi @Cathaya, what about this? Qualtrics.SurveyEngine.addOnload(function() { var input = jQuery("#"+this.questionId+" .InputText"); input.attr('type', 'number'); input.on('input', function() { this.value = this.value.replace(/e/g, ''); if(Number(this.value) >100) this.value = 100}); }); I've modified the code from @TomG mentioned here.

1 reply

fleb
Level 3 ●●●
Forum|alt.badge.img+6
  • Level 3 ●●●
  • Answer
  • May 23, 2019
Hi @Cathaya, what about this? Qualtrics.SurveyEngine.addOnload(function() { var input = jQuery("#"+this.questionId+" .InputText"); input.attr('type', 'number'); input.on('input', function() { this.value = this.value.replace(/e/g, ''); if(Number(this.value) >100) this.value = 100}); }); I've modified the code from @TomG mentioned here.