Can not update the HTML variables #2997
-
Hi,
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
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
There is a dictionary with penalty values for each possible id. I assume btw that the values you want to change are displayed in the paragraph and not in the image (in the code you sent you were trying to update the innerHTML of an image). The key is to use the on_load function of the trial, which will execute immediately after the trial is actually display on the screen. At that point you can get the relevant elements for which you want to change the value. That is, if you now use the following code in your
You should get an updated value on the next trial. Is this what you needed? |
Beta Was this translation helpful? Give feedback.
-
Thanks a lot, the |
Beta Was this translation helpful? Give feedback.
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