Have an idea?

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

Change the background color of one cell in a cbc analysis

Hi everyone,

We are trying to set up a cbc analysis using sawtooth. We are trying to change the background color to green of only one cell of the cbc. How is this possible?

We know that  similar questions have been asked, but the code never worked for us. So we would be much appreciative if someone could explain it to us, as we have no programming background at all.

Thank you!
Kind Regards,
Peter
asked Mar 26, 2017 by Peter

1 Answer

0 votes
Add this HTML to the text of the level you want to give the background color to:

<input type="hidden" class="cbcbg" data-bgcolor="#FF0000"/>


You can replace that hex color with any other color.  You may want to give the level an internal label to make analysis cleaner.

You can then put this code in the CBC footer:

<script>
$(document).ready(function(){
    $('.cbcbg').each(function(){
        $(this).closest('td').css('background-color', $(this).data('bgcolor'));
    });
})
</script>
answered Mar 26, 2017 by Zachary Platinum Sawtooth Software, Inc. (86,525 points)
...