Skip to content
Discussion options

You must be logged in to vote

Hi @mw719 ,

The button order is determined by the order in the choices array, so you can shuffle() the array to get a random order.

var trial = {
	type: 'html-button-response',
	stimulus: 'Pick one.',
	choices: jsPsych.randomization.shuffle(['Option One', 'Option Two'])
}

The trouble with this is that you need to know the button order to know which one was pressed. You can solve this by saving the button order in the trial's data like this:

var trial = {
	type: 'html-button-response',
	stimulus: 'Pick one.',
	choices: jsPsych.randomization.shuffle(['Option One', 'Option Two']),
	on_start: function(params){
		params.data.button_order = JSON.stringify(params.choices);
	}
}

The above method …

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@mw719
Comment options

@jodeleeuw
Comment options

@mw719
Comment options

Answer selected by jodeleeuw
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants