diff --git a/packages/plugin-image-slider-response/src/index.ts b/packages/plugin-image-slider-response/src/index.ts index 2e5c77ae..6fc184d2 100644 --- a/packages/plugin-image-slider-response/src/index.ts +++ b/packages/plugin-image-slider-response/src/index.ts @@ -108,6 +108,11 @@ const info = { type: ParameterType.BOOL, default: true, }, + /** If true, the slider's value will be displayed in real time below the slider. */ + value_display: { + type: ParameterType.BOOL, + default: true, + }, }, data: { /** The path of the image that was displayed. */ @@ -222,7 +227,13 @@ class ImageSliderResponsePlugin implements JsPsychPlugin { trial.max + '" step="' + trial.step + - '" id="jspsych-image-slider-response-response">'; + '" id="jspsych-image-slider-response-response" '; + if (trial.value_display) { + html += 'oninput="this.nextElementSibling.value = this.value">'; + html += "" + trial.slider_start + ""; + } else { + html += ">"; + } html += "
"; for (var j = 0; j < trial.labels.length; j++) { var label_width_perc = 100 / (trial.labels.length - 1);