Skip to content Skip to sidebar Skip to footer

How Can I Add A Keydown Function To Qualtrics?

First, thanks for reading this post. I am trying to force participants to read several pictures for 30 seconds each. For some specific pictures, participants are asked to press 'K

Solution 1:

Ryan,

I also saw your post on the Qualtrics LinkedIn Group. From that and this, I think I've pieced together what you are trying to do: you want show a picture for 30 seconds and record if someone presses "k" during that time, but not advance to the next page.

So, you should have two questions on your page: (1) a Descriptive Text question that shows the picture and (2) An unforced Multiple Choice, Multiple Answer question with a single answer option that will record if "k" was pressed. If you have anything else (e.g. a timing question) delete it. Then add the following script to the multiple choice question. It will hide the buttons, hide the multiple choice question, hide the question separator, record if "k" is pressed (as the answer to the multiple choice question), and advance the page after 30 seconds.

Qualtrics.SurveyEngine.addOnload(function()
{
    setTimeout("$('NextButton').click()",30*1000);
    $('NextButton').hide();
    if($('PreviousButton')) $('PreviousButton').hide();
    $(this.questionId).hide();
    $$('.Separator').invoke('hide');
    var that = this;

    Event.observe(document, 'keydown', functionkeydownCallback(e) {
        if(e.keyCode == 75) {
            that.setChoiceValue(1,'true');
        }
    });
});

Post a Comment for "How Can I Add A Keydown Function To Qualtrics?"