Restart/abort study button #1970
-
Hello Everybody :) I am currently designing a study in which I would need to have in every screen a restart/abort study button. Ideally somewhere on screen there would be a button to refresh the page and restart the experiment. I saw from the topic on the following link that Jatos.js has a function for this (' [https://forum.cogsci.nl/discussion/6194/jspsych-study-with-abort-button] (url)' ). However, since I am not using it as server I was wondering whether there was a way to do something similar without having to use Jatos. For example, I have been trying (probably using a wrong logic) to add a button to refresh the page within the event-related callback function : on_trial_start. https://stackoverflow.com/questions/29884654/button-that-refreshes-the-page-on-click So far I did not manage to make it work, does someone has a hint or knows whether this is possible to implement? Thanks a lot |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
Hi @marco2gandolfo, One thing you could do is use the <body>
<div id="jspsych-target"></div>
<button id="restart-btn">Restart the Experiment</button>
</body>
<script>
jsPsych.init({
display_element: 'jspsych-target'
})
</script> As far as implementing the button itself, I think that depends on what exactly you want the restart to mean. Is it just literally reloading the page, or do you want to do something else? |
Beta Was this translation helpful? Give feedback.
Hi @marco2gandolfo,
One thing you could do is use the
display_element
parameter injsPsych.init({...})
to have jsPsych run the experiment in a DOM element on the page, and then you could have a button on the page that wouldn't be part of the experiment.As far as implementing the button itself, I think that depends on what exactly you want the restart to mean. Is it just literally reloading the page, or do you want to do something else?