Skip to content
Discussion options

You must be logged in to vote

I think the stimulus property takes an HTML string so I'm not sure if you can access data attributes in it. One possibility is to create the random number as a separate variable outside the definition of the trial. That way you can access it everywhere within it:

let number = Math.floor(Math.random() * 100);

var ReadAbil_instructional_manipulation_check = {
  type: jsPsychHtmlKeyboardResponse,
  choices: [' '],
  trial_duration: 10000,
  data: { 
    task: 'ReadAbil_instructional_manipulation_check',
    digits_to_type_in: number 
    },
  stimulus: number ,
  on_finish: function(data) {
      /* Categorise passed check */
      if((number  < 50 & data.response == 'f') |
          (!numb…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@pablobernabeu
Comment options

@pablobernabeu
Comment options

Answer selected by pablobernabeu
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