Script: Auto Submit Next Page After Predetermined Amount of Time

This article will give you some code to automatically submit the next page button after a predetermined amount of time. 


Background

In some instances you may want to automatically submit the 'Next' button after a predetermined amount of time. Usually, this is used when showing a respondent a concept for 10 seconds, as an example. 


Instructions

  1. Program your question as needed.
  2.  Add the following code to the 'ADD JAVASCRIPT' field
    • See article: Adding JavaScript and/or CSS to a Question
    • Update the 25000 in the code below to the number you need. This number is in milliseconds. If you wanted 10 seconds, you would change that to 10000 (10 seconds X 1000). 
      var qCustomTimer;
      
      startTimer();
      jQuery('#cm-NextButton').on('click', function () {
        cancelTimer();
      });
      
      function startTimer() {
          qCustomTimer = setTimeout(function(){jQuery("#cm-NextButton").click();}, 25000); /* UPDATE TIME HERE */ 
      }
      
      function cancelTimer() {
        	if (qCustomTimer) {
      	    clearTimeout(qCustomTimer);
          }
      }
      		
  3. Make sure to test to confirm the time is correct
Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.

Still need help? Contact Us Contact Us