Hi,
I'm trying to do something very simple, but due to my naivety with javascript/programming it is proving somewhat difficult.
Basically, I'm just trying to get the first block of my experiment to be a consent_block where the participant will click on an 'agree' button to proceed with the experiment or a 'disagree' button to end the experiment.
To do this, I was thinking of making a few changes to the instructions plugin and have it send the 'disagree' information to the original HTML experiment file:
- I changed the buttons within the instructions plugin from "previous" and "next" to "agree" and "disagree", as well as their IDs and functions.
- When the user clicks the 'disagree' button, it opens the 'disagree' function. I believe I should have the function return a certain value (e.g. var noagree = true) to the original HTML to let it know that the 'disagree' button was clicked.
- From there, I think I should end the consent_block in the original HTML experiment with an if function similar to what is found in the end-experiment.html example provided in the jsPsych download folder.
- In that example, the code is as follows:
on_finish: function(data){
if(data.key_press == 78){
- Unfortunately, I still don't have a decent-enough grasp of things to know how to properly have the information that the disagree button was clicked sent to the HTML experiment to signal an end to the experiment.
Any tips would be greatly appreciated. Cheers.