Have an idea?

Visit Sawtooth Software Feedback to share your ideas on how we can improve our products.

Question to Zachary on Sliders: Single Value

Hi Zachary,

I really like the sliders. Can you please let me know where I can add a text/numbers to a slider? I want to show that the slider starts at e. g. 0 and the value on the right side is 100.

Thanks and best regards
Armin
asked Jun 9, 2020 by Armin
Where would these numbers be added?  Just sitting to the left and right of each slider?
Yes, to the left and right of each slider would be great

1 Answer

0 votes
Please try adding this script to the end of the Sliders footer:

<script>
$(document).ready(function(){
    $('#[% QuestionName() %]_div .inner_table > tbody > tr > td:last-child').each(function(){
        if ($(this).hasClass('col_label_cell')) {
            $(this).before('<td></td>');
            $(this).after('<td></td>');
        }
        else {
            $(this).before('<td>left...</td>');
            $(this).after('<td>right...</td>');
        }
    });
})
</script>


Lines 9 and 10 can be updated with the text to use.
answered Jun 10, 2020 by Zachary Platinum Sawtooth Software, Inc. (192,600 points)
Hi Zachary,
This is awesome. Thank you so much. Just one last thing. I now have 5 lines with text/numbers, but I only have 4 sliders. How can I get rid of the 5th line? Unfortunately I cannot send you a screenshot here.

 Sincerely
Armin
Can you describe what this fifth row is?  My code tries to check for the column label row and not add the text there.  Do you have a row that isn't the column label row and also doesn't have a slider?
Hi Zachary,
please have a look at the survey that I have uploaded.
https://testsliders2.sawtoothsoftware.com/login.html
Best regards
Armin
It appears that you have added my script to the "Grid Footer" section on the second tab of the grid question's settings.  Placing anything into this field causes an additional row to be added to the grid's table.  If you move this script into the "Footer" section on the first tab, you should get the behavior you are after.
Perfect! That was it. Thanks you so much and stay safe
showing the labels also in mobile version
...