Have an idea?

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

Click to move ranking instead of drag and drop

Is there any way I can have a drag and drop ranking question (into a container) where the respondent can click on the item to move it to the end of the list on the right rather than dragging and dropping it?
asked Apr 12, 2018 by Marion Silver (5,240 points)

1 Answer

0 votes
Interesting idea.  I've taken a stab at this by adding this code to a ranking question:

    $('.container_sort_area').on('sortstart', function( event, ui ){

    $('#[% QuestionName() %]_div .draggable_button').click(function(){
        if ($(this).hasClass('currentlyDragged')) {
        $('.unranked_container input[id^=[% QuestionName() %]_]').val('');
        var rankedButtons = $('.ranked_container input[id^=[% QuestionName() %]_]');
        for (var i = 0; i < rankedButtons.length; i++) {
            $(rankedButtons).eq(i).val(i + 1);
            $(rankedButtons).eq(i).siblings('.rank_display').find('.rank_number').text(i + 1);
answered Apr 12, 2018 by Zachary Platinum Sawtooth Software, Inc. (205,575 points)
Love it!  Thanks a heap, Zachary.