Have an idea?

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

Moving the input cell to the right in a Constant Sum question

Hi! I'm trying to swap the option cell and the input cell in a Constant Sum question. I tried using the following code found in another question, but it didn't seem to have any impact.
<script>
$(document).ready(function(){
    $('#[% QuestionName() %]_div .response_row').each(function(){
        $(this).append($(this).find('.input_cell'));
    });
     
    $(window).resize(function(){
        var maxWidth = 0;
        $('#[% QuestionName() %]_div .option_cell').each(function(){
            var thisWidth = $(this).width();
            if (thisWidth > maxWidth) {
                maxWidth = thisWidth;
            }
        });
        $('#[% QuestionName() %]_div .option_cell').width(maxWidth);
    });
     
    $(window).resize();
})
</script>


Any insight into why it's not working/how to get the input cells on the right side of the page would be appreciated! Thanks!
asked Mar 18 by KKing (300 points)

2 Answers

0 votes
Not sure about switching it on a Constant Sum type question, but what I've typically done instead is set it up using a grid style question, column based, and set it as a constant sum.  This way you can get the look you are desiring.
answered Mar 19 by Jay Rutherford Gold (34,155 points)
0 votes
Constant sums use tables instead of the divs of some other question types, so you'll want to use this:

$('#[% QuestionName() %]_div .input_cell').each(function(){
    $(this).parent().append($(this));
});


instead of this:

$('#[% QuestionName() %]_div .response_row').each(function(){
    $(this).append($(this).find('.input_cell'));
});
answered Mar 19 by Zachary Platinum Sawtooth Software, Inc. (143,625 points)
...