Hi all,
I am creating a survey in which I predominantly use array questions. As all questions are mandatory, I want to facilitate completing the survey by always checking the last answer option (answer range from 0%, 10%, ... 100%, no answer; no answer is not set by the survey standards, but is an own answer option - hope you know what I mean?)
I have used a dual-array scale previously, in which the assignment of a default answer worked perfectly using the respective workaround. However now, using only a normal array, it does not work anymore, nothing is checked...
I followed these instructions
www.limesurvey.org/manual/Workarounds:_M...s_in_array_questions
and also tested if javascript is active by the "Alert", which works fine. My LS version is 2.51.0+160829
This is the code that I put into the "Source" of the question (as you can see, my question ID is 1016, at least I suppose that it is as the title says
Edit question: WssbgrdeUndNgr (ID:1016) )
<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(1016, 12);
});
</script>
Looking forward to your replies! Thanks a lot