I tried some time to get the survey-text-plugin to do the same thing on pressing "Enter", as would be done when the subject clicked on the "Submit"-Button.
But due to my limited skills with JavaScript and Jquery, I can't get it to work at all.
Last thing I tried (in jspsych-survey-text.js) for example was trying to add an onkeydown event to the textbox:
$("#jspsych-survey-text-" + i).append('<input type="text" name="#jspsych-survey-text-response-' + i + '" onkeydown="runScript(event)"></input>');
function runScript(e){
if(e.keyCode == 13){
alert("pressed enter key"); // for testing
// it should do the exact same thing as
// $("#jspsych-survey-text-next").click
}
}
It only tells me that runScript is not defined.
So where would I need to put the function that is executed on click of the "Submit"-Button to work with "Enter"-KeyPress?
Thanks in advance,
Eduard
--
You received this message because you are subscribed to the Google Groups "jsPsych" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jspsych+u...@googlegroups.com.
To post to this group, send email to jsp...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jspsych/cd02b4be-c34f-4bb2-a5b5-67d4674b2a36%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Would you make part of your code available so I could try to figure it out also? I'm trying to do the same thing, only with the html-slider-response plugin (transfer the continue button's function to the spacebar).
Any help would be great!
Thanks,
P.N.