How to disable the tab key in a survey to prevent respondents from tabbing from 1 field to the next? | XM Community
Solved

How to disable the tab key in a survey to prevent respondents from tabbing from 1 field to the next?

  • 19 July 2018
  • 4 replies
  • 91 views

Hello, I have several text entry questions in a survey. I'd like to disable the ability of users/respondents from tabbing from one field to the next in order to 'force' them to spend a little more time on each question.

Thanks!
icon

Best answer by mattyb513 20 July 2018, 03:16

View original

4 replies

Userlevel 6
Badge +6
The way to do this is to listen for a key press, and then if the key is tab, to return false; you can look at other answered posts for how to do that.

However, you should not do this unless you know your participants as it will be a huge accessibility issue for those using a screen reader among others.
mattyb513, you make an excellent point about accessibility. Noted. We know our population well enough to want to move forward. I've tried this, with no success. Any suggestions?

Qualtrics.SurveyEngine.addOnload(function()
{
$("input:text").keypress(function (event) {
if (event.keyCode == 9) return false;
})
});
Userlevel 6
Badge +6
Looks like you have to use the `.preventDefault()` method:

https://gist.github.com/mattbloomfield/3901f7cdc26202d2a8178509981d7152
Thanks. That did it. Much obliged.

Leave a Reply