jsPsych/tests&examples/jspsych-survey-multi-choice.html
2015-09-23 10:18:30 -04:00

42 lines
1.4 KiB
HTML

<!doctype html>
<html>
<head>
<script src="js/jquery.min.js"></script>
<script src="../jspsych.js"></script>
<script src="../plugins/jspsych-survey-multi-choice.js"></script>
<link rel="stylesheet" href="../css/jspsych.css"></link>
</head>
<body>
<div id="jspsych-target"></div>
</body>
<script>
// defining groups of questions that will go together.
var page_1_questions = ["I like vegetables.", "I hate eggs."];
var page_2_questions = ["I like fruit."];
// 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: [page_1_questions, page_2_questions],
options: [[page_1_options, page_1_options], [page_2_options]], // need one scale for every question on a page
required: [[true, false], [true]], // set whether questions are required
// horizontal: true // centres questions and makes options display horizontally
};
jsPsych.init({
display_element: $('#jspsych-target'),
experiment_structure: [multi_choice_block],
on_finish: function() {
console.log(jsPsych.data.displayData());
}
});
</script>
</html>