Hmm, I checked the header, and it's good. It's still not validating. Should I be replacing any of the JS with my own code, e.g. ("#"+this.questionId+" .InputText")? Inserting the questionID?
Thanks for simplifying the solution @TomG. I've read your's and others' threads on moment.js and I think I have it set up right, but I must be missing something. Do I need to assign an embedded data field labeled "age" (I don't know how to do this. Here is what I've done so far, in the header: <script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.21.0/moment.min.js"></script> And this in the question JS field: Qualtrics.SurveyEngine.addOnload(function() { /*Place your JavaScript here to run when the page loads*/ }); Qualtrics.SurveyEngine.addOnPageSubmit(function() { var age = moment().diff(moment(jQuery("#"+this.questionId+" .InputText").val()), 'years'); Qualtrics.SurveyEngine.setEmbeddedData('age', age); if(age > 13 && age < 25) Qualtrics.SurveyEngine.setEmbeddedData('eligible', '1'); }); Qualtrics.SurveyEngine.addOnUnload(function() { /*Place your JavaScript here to run when the page is unloaded*/ }); Thanks for your expertise! &
Already have an account? Login
Enter your username or e-mail address. We'll send you an e-mail with instructions to reset your password.
Sorry, we're still checking this file's contents to make sure it's safe to download. Please try again in a few minutes.
Sorry, our virus scanner detected that this file isn't safe to download.