Solved
Using Javascript

Hello,
I am trying to program in a question that has a calendar format using javascript code I found. I have never used javascript so I am not sure how to program it into Qualtrics. The code is below and I have tried to insert it into the Javascript option when creating a new question. However, it doesn't appear to do anything. Could anyone advise me on how to get it to work? I also have html code if that would be easier to program. I tried inserting that in the html option when you click on rich text but it didn't seem to work.
Here is the link to the javascript and html code.
https://codepen.io/Lewis65/pen/wGjKQg
Best answer by Anonymous
Hello @mailysteers ,
This will allow participants to select only dates 30 days prior to the date they are taking the survey:
Step 1: Paste the following code in the "Look and feel" -> "Advanced" -> "header"(edit) -> "Source"(<>)
<link href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css" rel="stylesheet" />
<link href="/resources/demos/style.css" rel="stylesheet" />
<script src="https://code.jquery.com/jquery-1.12.4.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
</script><script src="https://jqueryui.com/resources/demos/datepicker/i18n/datepicker.js"></script>
Step 2: Add following js(OnReady) to the Text Entry question where participants selects the date
jQuery( "[id='QR~"+this.questionId+"']" ).datepicker({
minDate: -30 ,
maxDate: -1
}).attr('readonly', true);
View originalLeave a Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.