/** * jspsych-survey-text * a jspsych plugin for free response survey questions * * Josh de Leeuw (March 2013) * Updated October 2013 * * parameters: * questions: array of arrays. inner arrays are arrays of strings, where each string represents a prompt * for the user to respond to. * data: optional data object * */ (function($) { jsPsych.survey_text = (function() { var plugin = {}; plugin.create = function(params) { var trials = []; for (var i = 0; i < params.questions.length; i++) { trials.push({ type: "survey_text", questions: params.questions[i], data: (typeof params.data === 'undefined') ? {} : params.data[i] }); } return trials; }; plugin.trial = function(display_element, block, trial, part) { // add likert scale questions for (var i = 0; i < trial.questions.length; i++) { // create div display_element.append($('
' + trial.questions[i] + '
'); // add text box $("#surveytext" + i).append(''); } // add submit button display_element.append($('