- Posts: 16
- Thank you received: 0
Ask the community, share ideas, and connect with other LimeSurvey users!
<script type="text/javascript"> function Custom_On_Load(){ $(document).ready(function() { /* Hide the answer box from this current question, because we will store the value of the count in this question */ $( ‘#question77′ ).hide(); $( ‘#question76 td.answer input.checkbox’ ).change(function() { var checkedCount = 0; $( ‘#question76 td.answer input.checkbox’ ).each(function(i) { if ( $( this ).attr(‘checked’) == true ) { checkedCount++; } }); if ( checkedCount > 1 ) { $( ‘#question77 td.answer input.checkbox’ ).attr(‘checked’, true); } else { $( ‘#question77 td.answer input.checkbox’ ).attr(‘checked’, false); } }); }); } </script>
{12 - count(q_1, q_2, q_3, ..., q_70)}
is there some kind of scripting event so that all the checked answers in multiple choices question become red or green or any other color when the user check the corresponding checkboxes?
$(document).ready(function(){ // Listener on the checkboxes $('input.checkbox').click(function(e){ if($(this).is(':checked')) { $(this).next('label').addClass('checkedLabel'); } else { $(this).next('label').removeClass('checkedLabel'); } }); });
.checkedLabel { color:#009900; }