- Posts: 10208
- Thank you received: 3632
Ask the community, share ideas, and connect with other LimeSurvey users!
Yes, because it was inlinedtpartner wrote: Hmm...I just tested in 2.5.7 and don't seem to need those trigger events to fire Expression Manager
<input type="radio" onclick="checkconditions($(this).val(), $(this).attr('name'), 'radio', 'click') />
<script type="text/javascript" charset="utf-8"> $(document).ready(function() { // Identify this question var thisQuestion = $('#question{QID}'); // Add some classes $('.question-item:not(:last)', thisQuestion).addClass('non-exclusive-item'); $('.question-item:last', thisQuestion).addClass('exclusive-item'); // Handle exclusive items $('input.checkbox', thisQuestion).on('change', function(e) { if($(this).is(':checked')) { var actionItems = $('.non-exclusive-item', thisQuestion); if($(this).closest('.question-item').hasClass('non-exclusive-item')) { actionItems = $('.exclusive-item', thisQuestion); } actionItems.each(function(i) { $('input.checkbox', this).prop('checked', false).trigger('change'); $('input:hidden', this).attr('value', ''); $('input[type="text"]', this).val('').trigger('keyup'); }); } }); }); </script>
I just tested and it does work in 2.06 LTS. Can you attach a small sample survey containing only the affected question?I have tried using this script in version 2.6.7-lts Build 171212 and it doesn’t work.
tpartner wrote: Try this:
Code:<script type="text/javascript" charset="utf-8"> $(document).ready(function() { // Identify this question var thisQuestion = $('#question{QID}'); // Uncheck all excluded items $('div.question-item:last input.checkbox', thisQuestion).on('change', function(e) { if($(this).is(':checked')) { $('input.checkbox', thisQuestion).not($(this)).each(function(i) { $(this).prop('checked', false); $(this).nextAll('input:hidden:eq(0)').attr('value', ''); }); $('input[type="text"]', thisQuestion).val(''); } }); }); </script>
tpartner wrote: Try changing all instances of 'input.checkbox' to 'input [type="checkbox"]'