/
jspsych-survey-likert.html
43 lines (37 loc) · 1.25 KB
/
jspsych-survey-likert.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<!DOCTYPE html>
<html>
<head>
<script src="../packages/jspsych/dist/index.browser.js"></script>
<script src="../packages/plugin-survey-likert/dist/index.browser.js"></script>
<link rel="stylesheet" href="../packages/jspsych/css/jspsych.css" />
</head>
<body></body>
<script>
var jsPsych = initJsPsych({
on_finish: function() {
jsPsych.data.displayData();
}
});
var scale = ["Strongly Disagree", "Disagree", "Neutral", "Agree", "Strongly Agree"];
var likert_trial = {
type: jsPsychSurveyLikert,
questions: [
{prompt: "I like vegetables.", name: 'Vegetables', labels: scale, required: true},
{prompt: "I like fruit.", name: 'Fruit', labels: scale, required: true}
],
};
var likert_trial_random_order = {
type: jsPsychSurveyLikert,
questions: [
{prompt: "Question 1", labels: scale},
{prompt: "Question 2", labels: scale},
{prompt: "Question 3", labels: scale},
{prompt: "Question 4", labels: scale},
{prompt: "Question 5", labels: scale}
],
randomize_question_order: true,
scale_width: 500
};
jsPsych.run([likert_trial, likert_trial_random_order]);
</script>
</html>