- Posts: 2
- Thank you received: 0
Ask the community, share ideas, and connect with other LimeSurvey users!
<script type="text/javascript" charset="utf-8"> $(document).ready(function() { // Identify the questions var qID = {QID}; var thisQuestion = $('#question'+qID); var quotaQuestion = $(thisQuestion).nextAll('.list-radio:eq(0)'); // The sub-question code of the mandatory option var mandatoryOptionCode = 'b'; // Hide the quota question $(quotaQuestion).hide(); // Interrupt the Next/Submit function $('form#limesurvey').submit(function(){ // Is the mandatory option checked? if($('input.checkbox[id$="X'+qID+mandatoryOptionCode+'"]').is(':checked') == false) { // No, so click the quota radio $('input.radio', quotaQuestion).click(); } else { // Yes, so uncheck the quota radio $('input.radio', quotaQuestion).attr('checked', false); } }); }); </script>