A JavaScript library for creating and running behavioral experiments in a web browser.
Questions tagged [jspsych]
71 questions
4
votes
1 answer
Skip rest of timeline if participant provides n correct answers (jspsych)
I have n decision trials in a timeline. Correct answers are recorded as data attributes. I want to skip the rest of the timeline if the participant provided a fixed number of correct answers. This calls for a conditional, but mine doesn't work.
var…

petyar
- 491
- 3
- 10
4
votes
1 answer
JSPsych - Balanced allocation of participants to conditions
I started using JSPsych/javascript a few months ago and have now coded my first full experiment. I ran a pilot and it became clear that my participants were not being evenly assigned to conditions.
To assign participants to conditions I'm using a…

Con Des
- 359
- 1
- 2
- 9
3
votes
1 answer
Dynamically adding trials to experiment based on user input?
I'm currently using JsPsych to create a behavioral experiment, particularly Matrix Reasoning, so the user chooses from a set of options based on a logic pattern.
My problem is that I need to repeat certain trials if the user fails when answering the…

N7 Mech
- 110
- 7
3
votes
0 answers
add jsPsych to Qualtrics
Does anyone have experience with adding a jsPsych script to Qualtrics?
I've added my script, uploaded all jsPsych files to the library and added custom CSS. However, Qualtrics does not display any content.
All help would be much appreciated!
This…

Jessica Witvoet
- 31
- 2
2
votes
1 answer
xhr posting data on Firefox and page redirection: NS_BINDING_ABORTED
I am trying to code a jsPsych experiment, hosted on a LAMP server. Everything works well; at the end, I am trying to move to the next task by performing a redirection.
Here is the code:
saveData(save_url, data_dir, file_name, extension,…

Paidon
- 41
- 5
2
votes
1 answer
Why does the position:static CSS property indent the first line of my paragraph?
I am trying to display some HTML code on my screen using the JavaScript library jsPsych, but I keep getting a weird indent in my first paragraph (the one below the globe images in the code snippet further down).
If I set the paragraph's position…

puzzleGuzzle
- 101
- 10
2
votes
1 answer
jsPsych: change button position and style
I am trying to display two buttons using the jsPsych html-button-response plugin (https://www.jspsych.org/plugins/jspsych-html-button-response/). I am using images as buttons instead of text. I specified them in my "choices:" option as choices:…

gimi
- 395
- 3
- 13
2
votes
1 answer
jsPsych randomization function repeating final trial in loop
I'm using a for loop to create test trials in which each test item is presented once but the final item is always presented twice.The loop is meant to show each rocksize once in a random order. I've tried various randomisation functions (shuffle,…

Con Des
- 359
- 1
- 2
- 9
2
votes
2 answers
Jspsych: Putting 3 p tags in the center of the page, aligned to the left?
Guess I'm pretty stuck.
So here's what I got visually right now.
I added that comic sans caption and the arrow in MS paint.
Each of those lines containing the color swatches is a p tag. Ideally, I want these p tags to be put in the center of the…

Byron Smith
- 587
- 10
- 32
2
votes
1 answer
Storing data with nested .each() function causes to replicate values
I've modified a survey-multi-choice plugin from JsPsych, in order to get responses in the form of checkboxes, instead of radio-buttons, since I need to present an image to the user, followed by 4 alternatives, like this:
Where A, B, C and D are…

N7 Mech
- 110
- 7
2
votes
1 answer
Why autofocus property works only on first trial?
I need to code a number of trials for a JsPsych experiment displaying a simple math question. The user must answer in a textbox as fast as possible and then press the Enter key to move to the next question. And so on.
On each question, a single…

N7 Mech
- 110
- 7
1
vote
1 answer
How to change the color of the slider thumb upon interaction?
I am new to HTML and CSS stuff. I am setting up a website where basically on the screen there will be multiple vertical sliders and people have to make an input to each of these sliders to move to the next screen. What I also want is that when they…

Subha Nawer Pushpita
- 109
- 3
- 11
1
vote
0 answers
Costumize button_html in JsPsych
Does anyone know how to specify the button_html, so it also allows for the participant to press 'r' on the keyboard to repeat the sound/trial? R doesn't need to be shown as a button on the screen it only needs to be possible to press it to…

carolinehommel
- 11
- 2
1
vote
1 answer
Load text from a .txt file and display in jsPsychHtmlButtonResponse
I want to use jsPsychHtmlButtonResponse to display a .txt-file from a local folder on my computer.
The reproducible code below does not work, while a very similar adaptation works for the display of images with jsPsychImageButtonResponse.
Does not…

CapsLock
- 11
- 3
1
vote
3 answers
How come I can only access 39.9% of my array?
I have an array of 1000 data, but for some reason, I can only access 39.9% of these data.
This issue arises in a reaction time game that I am coding using a JavaScript library called jsPsych. In the game, a user must click a button before an image…

puzzleGuzzle
- 101
- 10