Javascript for side by side question with date formatting | XM Community
Skip to main content

Hello,

I have a question about inserting Javascript in order to give the statements in a side-by-side question a date format.  There is one column with two possible answers and three statements.  I want each box to have a mm/dd/yyyy formatting.  I inserted javascript to do so, and it works, but only in the first box.  I’m not sure how to make it apply to each of the possible boxes.

Thank you for any help.  I am not familiar with Javascript at all 😕

 

Try this code and it should work!

 

Qualtrics.SurveyEngine.addOnload(function(){
/* Place your JavaScript here to run when the page loads */
});

Qualtrics.SurveyEngine.addOnReady(function(){
jQuery("#" + this.questionId + " .InputText").each(function() {
new Cleave(jQuery(this), {
date: true,
delimiter: '/',
datePattern: 'm', 'd', 'Y']
});
});
});

Qualtrics.SurveyEngine.addOnUnload(function(){
/* Place your JavaScript here to run when the page is unloaded */
});

 


That works perfectly, thank you!!


Leave a Reply