Hi all,
I run memory-research surveys with heavy custom JavaScript, both in question-level code and in the survey header. After the New Survey-Taking Experience was enforced, they broke, and I've been fighting a navigation problem I can't fully explain. Hoping someone here has seen this.
Background
My question-level code advances pages with jQuery, e.g.:
javascript
jQuery('input[type="radio"]').on('click', function(){ jQuery('#NextButton').click(); });After the update, this silently stopped working for many respondents — my hypothesis is that jQuery is no longer preloaded. To compensate, I added header JavaScript that advances 1-radio "continue" pages itself. This is the current header:
javascript
Qualtrics.SurveyEngine.addOnload(function() {
var radios = document.querySelectorAll('input[type="radio"]');
if (radios.length === 2) return; // coding item — keyboard only, leave alone
if (window.Event && Event.stopObserving) {
Event.stopObserving(document, 'keydown'); // clear a keydown listener that survives between pages
}
});
Qualtrics.SurveyEngine.addOnReady(function() {
var that = this;
var radios = document.querySelectorAll('input[type="radio"]');
if (radios.length !== 1) return; // only "continue" pages (single radio)
if (radios[0].dataset.bound) return;
radios[0].dataset.bound = '1';
var r = radios[0];
function handler(e){
if(!document.contains(r)){ document.removeEventListener('click',handler,true); return; }
if(e.target.closest('input[type="radio"], label, td, .q-radio')){
document.removeEventListener('click',handler,true);
r.checked = true;
try { that.setChoiceValue(parseInt(r.value, 10), true); } catch(err){}
requestAnimationFrame(function(){
requestAnimationFrame(function(){ that.clickNextButton(); });
});
}
}
document.addEventListener('click', handler, true);
});The problem
For a portion of respondents, pages now advance twice on a single click — a page flashes and is skipped automatically. It corrupts data, including on critical response-time pages. My working theory: for respondents where jQuery IS still active, both the header code above and the legacy question code fire on one click → double advance.
What I can't explain
I compared affected and unaffected survey versions directly — header, question code, and page structure are all identical — yet skip rates differ dramatically: from ~0.1% of pages up to ~36% of pages, measured from exported Page Submit timings (near-zero = skipped). Same code, wildly different skip rates. This is the part that baffles me.
My questions
- Has anyone confirmed under exactly what conditions jQuery is / isn't available in the new experience? Could it vary per respondent (e.g. gradual rollout, browser, cache)?
- Is the "header advances + legacy code advances" double-fire the likely cause, and what's the cleanest fix — remove the header advance and rely on local code, or load jQuery explicitly and remove the header advance?
- Any idea what could make identical survey versions skip at 0.1% vs 36%?
I can share more code and the timing data. Any insight appreciated — thanks!
