- Posts: 8
- Thank you received: 0
Ask the community, share ideas, and connect with other LimeSurvey users!
Please Log in to join the conversation.
<script type="text/javascript" data-author="Tony Partner"> $(document).on('ready pjax:scriptcomplete',function(){ var thisQuestion = $('#question{QID}') // Add some classes to the checkbox cells $('tr[id^="javatbd"]', thisQuestion).each(function(i) { // Last two columns exclusive $('td.checkbox-item', this).slice(-2).addClass('exclusive-item'); }); // A function to un-check boxes function resetCheckbox(thisItem) { $(':hidden', thisItem).val(''); $(':checkbox', thisItem).prop('checked', false).trigger('change'); } // A listener on the checkboxes $(':checkbox', thisQuestion).on('change', function(e) { if($(this).is(':checked')) { var thisItem = $(this).closest('.answer-item'); var thisRow = $(this).closest('tr'); var items = $('td.answer-item.exclusive-item', thisRow); if($(thisItem).hasClass('exclusive-item')) { items = $('td.answer-item', thisRow).not(thisItem); } $.each(items, function(i, el) { resetCheckbox(el); }); } }); }); </script>
Please Log in to join the conversation.
Please Log in to join the conversation.