- Posts: 73
- Thank you received: 1
Ask the community, share ideas, and connect with other LimeSurvey users!
<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', ''); }); } }); }); </script>
<script type="text/javascript" charset="utf-8"> $(document).ready(function(){ // Identify this question var thisQuestion = $('#question{QID}'); // Uncheck all excluded items var itemsLength = $('div.question-item', thisQuestion).length; $('div.question-item:gt('+(itemsLength-3)+') 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', ''); }); } }); }); </script>
Don't crosspost please ......BBCMResearch wrote: .....
Is it possible to reset the text field for the other option when the exclusive option is checked?
....
<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>