Skip to content
Discussion options

You must be logged in to vote

Hi!

This was an interesting puzzle, but I think the explanation for why it does not update is because the button_html code is implemented when all the trials are created. This happens when your timeline is initialized, so it will simply take the value of penalty at the start of your experiment.

I have changed the code as follows

   var penalty_values = {
        'A' : 200,
        'B' : 150,
        'C' : 100,
        'D' : 50
      };

    var grid_buttons = {
      type: jsPsychImageButtonResponse,

      stimulus: "",
      choices: ["A", "B", "C", "D"],
      button_html: "<div>" + '<button onclick = "color(\'%choice%\')"><img id="%choice%" src="%choice%.jpeg"></button>' + '<p id = "t…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by hodaVS
Comment options

You must be logged in to vote
0 replies
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