Using Keyboard to Select Correct Answer AND Auto-Advance | XM Community
Skip to main content

I am currently working on a study with Navon letters and would like participants to use their key board to answer correctly, I would also like it to auto-advance to the next question. This is the java script I have been using. Please let me know what I can do to make this work!
Qualtrics.SurveyEngine.addOnload(function()

{
/*Place your JavaScript here to run when the page loads*/    var qobj = this;
    jQuery(document).keypress(function(event) {
        var key = event.key.toUpperCase();
        if(key == "J" || key == "F") {
            jQuery(this).trigger("mouseup");
            if(key == "J") qobj.setChoiceValueByRecodeValue(1,true);
            else qobj.setChoiceValueByRecodeValue(2,true);
        }
    });
});Qualtrics.SurveyEngine.addOnReady(function()
 
{
/*Place your JavaScript here to run when the page is fully displayed*/
jQuery('inputatype="radio"]').on('click',function(){jQuery('#NextButton').click();});
});Qualtrics.SurveyEngine.addOnUnload(function()
{
/*Place your JavaScript here to run when the page is unloaded*/});
Thanks!

Be the first to reply!

Leave a Reply