- Posts: 25
- 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(){ //THIS IS THE AT-CENTER VERSION // The question IDs var q1 = 1; var qHidden = 40; // Hide the hidden question $('#question'+qHidden+'').hide(); // Assign classes to the inputs $('#question'+q1+' input.radio').each(function(i) { $(this).addClass('q1Row'+(i+1)+''); }); $('#question'+qHidden+' input.checkbox').each(function(i) { $(this).addClass('qHiddenRow'+(i+1)+''); }); // Interrupt the Next/Submit function $('form#limesurvey').submit(function(){ // Reset the hidden question $('#question'+qHidden+' input.checkbox').attr('checked', false); // If q1 row 1 is checked we do this if($('.q1Row1').attr('checked') == true) { $('.qHiddenRow1').attr('checked', true); $('.qHiddenRow2').attr('checked', true); $('.qHiddenRow3').attr('checked', false); $('.qHiddenRow4').attr('checked', true); } if($('.q1Row2').attr('checked') == true) { $('.qHiddenRow1').attr('checked', false); $('.qHiddenRow2').attr('checked', true); $('.qHiddenRow3').attr('checked', true); $('.qHiddenRow4').attr('checked', true); } // Carry on with submit return true; }); }) </script>
.attr('checked'
.prop('checked'