Skip to content

enable_button_after doesn't work for image-button-response plugin #3562

@dhalpern

Description

@dhalpern

enable_button_after successfully disables buttons for 2 seconds when using the html-button-response plugin but not for the image-button-response plugin. See below for a reprex.

<!DOCTYPE html>
<html>
  <head>
    <title>My experiment</title>
    <script src="https://unpkg.com/[email protected]"></script>
    <script src="https://unpkg.com/@jspsych/[email protected]"></script>
    <script src="https://unpkg.com/@jspsych/[email protected]"></script>
    <link href="https://unpkg.com/[email protected]/css/jspsych.css" rel="stylesheet" type="text/css" />
  </head>
  <body></body>
  <script>

    /* initialize jsPsych */
    var jsPsych = initJsPsych({
      on_finish: function() {
        jsPsych.data.displayData();
      }
    });

    /* create timeline */
    var timeline = [];

    timeline.push({
      type: jsPsychHtmlButtonResponse,
      stimulus: '<p style="color: red; font-size: 48px; font-weight: bold;">GREEN</p>',
      choices: ['Green', 'Blue', 'Red'],
      enable_button_after: 2000,
      prompt: "<p>What color is this word? (button enable after 2s)</p>"
    });

    timeline.push({
      type: jsPsychImageButtonResponse,
      stimulus: 'img/happy_face_1.jpg',
      choices: ['Happy', 'Sad'],
      enable_button_after: 2000,
      prompt: "<p>What emotion is this person showing? (button enable after 2s)</p>",
      post_trial_gap: 500
    });

    /* start the experiment */
    jsPsych.run(timeline);

  </script>
</html>

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions