jsPsych/examples/jspsych-survey-multi-choice.html
2020-05-26 20:20:03 -05:00

41 lines
1.3 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<script src="../jspsych.js"></script>
<script src="../plugins/jspsych-survey-multi-choice.js"></script>
<link rel="stylesheet" href="../css/jspsych.css">
</head>
<body></body>
<script>
// definiting two different response scales that can be used.
var page_1_options = ["Strongly Disagree", "Disagree", "Neutral", "Agree", "Strongly Agree"];
var page_2_options = ["Strongly Disagree", "Disagree", "Somewhat Disagree", "Neural", "Somewhat Agree", "Agree", "Strongly Agree"];
var multi_choice_block = {
type: 'survey-multi-choice',
questions: [
{prompt: "I like vegetables", name: 'Vegetables', options: page_1_options, required:true},
{prompt: "I like fruit", name: 'Fruit', options: page_2_options, required: false}
],
};
var multi_choice_block_horizontal = {
type: 'survey-multi-choice',
questions: [
{prompt: "I like vegetables", options: page_1_options, required: true, horizontal: true,},
{prompt: "I like fruit", options: page_2_options, required: false, horizontal: true}
],
};
jsPsych.init({
timeline: [multi_choice_block, multi_choice_block_horizontal],
on_finish: function() {
jsPsych.data.displayData();
}
});
</script>
</html>