/* jspsych-survey-text
* a jspsych plugin for free response survey questions
*
* Josh de Leeuw (March 2013)
*
*/
(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]
});
}
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($('
', { "id": 'surveytext'+i, "class": 'surveyquestion'}));
// add question text
$("#surveytext"+i).append('
'+trial.questions[i]+'
');
// add text box
$("#surveytext"+i).append('
');
}
// add submit button
display_element.append($('