- Posts: 1
- 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() { // A function to pre-check a column of an array function checkedDefault(qID, column) { var checkedCol = column - 1; $('#question' + qID + ' table.question tbody tr').each(function(i) { if ($('input.checkbox[checked=true]', this).length == 0) { $('input.checkbox:eq(' + checkedCol + ')', this).attr('checked', true); } }); } // Call the function with a question ID and column number checkedDefault(165, 1); }); </script>
<script type="text/javascript" charset="utf-8"> $(document).ready(function() { // A function to pre-check a column of an array function checkedDefault(qID, column) { var checkedCol = column - 1; $('#question'+qID+' tr.subquestions-list').each(function(i) { if ($('input.checkbox:checked', this).length == 0) { $('input.checkbox:eq('+checkedCol+')', this).prop('checked', true); $('input.checkbox:eq('+checkedCol+')', this).parent().find('input[type="hidden"]').val(1); } }); } // Call the function with a question ID and column number checkedDefault(165, 1); }); </script>