Have an idea?

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

Repeat Best-Worst Labels in MaxDiff

Hi! I have a MaxDiff question where I'd like the Best/Worst labels to repeat for each row. Is that possible to configure?
asked May 11 by Adam

1 Answer

0 votes
Adding this script to a MaxDiff should cause the first row to be repeated between all other rows of the table:

<script>
$(document).ready(function(){
    var headerTr = $('#[% QuestionName() %]_div .inner_table > tbody > tr:first-child');
    $('#[% QuestionName() %]_div .body_row').slice(1).each(function(){
        $(this).before(headerTr.clone());
    });
})
</script>


Does that get you close to what you're after?
answered May 11 by Zachary Platinum Sawtooth Software, Inc. (206,100 points)
That's almost it, thanks! The header has a bottom border that also gets repeated. Any way to remove that?
Sure.  I see there's a border beneath both the item rows and header rows.  Do you want the border removed from all header rows and kept for all item rows?
Yup, I think that would do it
Adding this CSS to the question should do it:

<style>
#[% QuestionName() %]_div .inner_table > tbody > tr:not(.body_row) > td {
    border-bottom: 0px;
}
</style>
Thank you so much!
...