I have a silly question.
I want my participants to see the numerical value when they use the slider component.
I have a text component with the following:
$slider.getRating()
And it works. But at the beginning of each trial, instead of numbers I see “Hello world” message. When I start using the slider, it disappears and the numerical values appear, as they should. Is there a way to delete this “Hello world” message in the beginning of the trial?
Alternatively, you could expose the text_4 component to your browser, then you can try things out in the console. See this tutorial to find out how: Thomas Pronk / demo_expose_js · GitLab
in javascript you need to get the current marker position using (getRating doesn’t work in psychojs):
thisPos = slider._markerPos
you can then use thisPos as the rating - but since a marker is not created untill a response has been made this is initially undefined, so you first need to use:
if (typeof slider._markerPos !== 'undefined') {
thisPos = slider._markerPos;
}
Ahaaaaa… thanks @Becca! Now I get it: when setting the value of the text to undefined it reverts to it’s default value, which is “Hello world”. Perhaps we should change the default value to something different?