Hi Experts,
In one of my Survey question i need to validate the participants should enter only 8 numbers. I have achieved using the below jquery code.
And now i also want to restrict special characters. Please help how to achieve this,
Below code used to restrict only 8 numbers.
jQuery("#"+this.questionId+" .InputText").each(function () {
jQuery(this).on("input", function() { this.value = this.value.substr(0,8); });
Thanks in Advance,
Krishna Prabhu
Page 1 / 1
Use .replace() with regex.
Thanks for replying. But i am not getting entire code.
Can you please to share the full code?
Thanks in Advance.
You weren't specific enough about what you want to exclude.
Hi Tom,
I want to exclude Characters and special characters. The participants have to enter only numbers of length 8. Please help.
I am new to Qualtrics with limited knowledge in coding.
Thanks in advance,
Krishna Prabhu
this.value = this.value.replace(/[^0-9]/g,'').substr(0,8);
Thanks a lot . This worked.
Leave a Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.