- Posts: 3
- 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 this question var thisQuestion = $('#question{QID}'); // Identify the second scale answers $('.answer-item[class^="answer_cell_2"]', thisQuestion).addClass('scale-2-item'); // Set a default answer for the second scale $('.answers-list', thisQuestion).each(function(i) { if($('.scale-2-item input[type="radio"]:checked', this).length == 0) { $('.scale-2-item input[type="radio"]:last', this).click(); } }); }); </script>
<script type="text/javascript" charset="utf-8"> $(document).ready(function() { // Scale to set the default answer on var defaultAnsweredScale = 2; // Column of that scale to set as default answer var defaultAnsweredColumn = 3; // Identify this question var thisQuestion = $('#question{self.qid}'); // Identify the scales and columns $('.answer-item[class^="answer_cell_1"]', thisQuestion).addClass('scale-1-item'); $('.answer-item[class^="answer_cell_2"]', thisQuestion).addClass('scale-2-item'); $('tr.answers-list', thisQuestion).each(function(i) { $('.scale-1-item', this).each(function(i) { $(this).addClass('scale-1-column-'+(i+1)+'-item'); }); $('.scale-2-item', this).each(function(i) { $(this).addClass('scale-2-column-'+(i+1)+'-item'); }); }); // Click the default answers $('tr.answers-list', thisQuestion).each(function(i) { if($('.scale-'+defaultAnsweredScale+'-item input[type="radio"]:checked', this).length == 0) { $('.scale-'+defaultAnsweredScale+'-column-'+defaultAnsweredColumn+'-item input[type="radio"]:last', this).click(); } }); }); </script>