- Posts: 10223
- Thank you received: 3640
Ask the community, share ideas, and connect with other LimeSurvey users!
Knows everyone how I have to change the code that the reset button works with the array dual scale?
<script type="text/javascript" charset="utf-8"> $(document).ready(function(){ addReset('{QID}'); function addQuestionReset(qID) { var thisQuestion = $('#question'+qID+''); $('table.subquestions-list', thisQuestion).after('<input type="button" style="float:right;" value="Reset Question" class="resetQuestionButton" />'); $('#question'+qID+' .resetQuestionButton').click(function(e){ $('input.radio', thisQuestion).attr('checked', false); }); } }); </script>
Is it possible to set one reset button for two question which are in the same question group?
I have two dual scales side by side and want only one rest button for them.
$('input.radio', thisQuestion).attr('checked', false);
$('.array-flexible-duel-scale input.radio').attr('checked', false);
$('#question775 input.radio, #question1066 input.radio').attr('checked', false);
tpartner wrote: Here is a more generic version of the code:
Code:<script type="text/javascript" charset="utf-8"> $(document).ready(function(){ addReset('{QID}'); function addQuestionReset(qID) { var thisQuestion = $('#question'+qID+''); $('table.subquestions-list', thisQuestion).after('<input type="button" style="float:right;" value="Reset Question" class="resetQuestionButton" />'); $('#question'+qID+' .resetQuestionButton').click(function(e){ $('input.radio', thisQuestion).attr('checked', false); }); } }); </script>
<script type="text/javascript" charset="utf-8"> $(document).ready(function(){ addReset('19'); function addQuestionReset(qID) { var thisQuestion = $('#question'+qID+''); $('table.subquestions-list', thisQuestion).after('<input type="button" style="float:right;" value="Reset Question" class="resetQuestionButton" />'); $('#question'+qID+' .resetQuestionButton').click(function(e){ $('input.radio', thisQuestion).attr('checked', false); }); } }); </script>
<script type="text/javascript" charset="utf-8"> $(document).ready(function(){ addQuestionReset('{QID}'); function addQuestionReset(qID) { var thisQuestion = $('#question'+qID+''); $('table.subquestion-list', thisQuestion).after('<input type="button" style="float:right;" value="Reset Question" class="resetQuestionButton" />'); $('#question'+qID+' .resetQuestionButton').click(function(e){ $('input.radio', thisQuestion).prop('checked', false); }); } }); </script>
tpartner wrote: Try this (no need to modify {QID}):
Code:<script type="text/javascript" charset="utf-8"> $(document).ready(function(){ addQuestionReset('{QID}'); function addQuestionReset(qID) { var thisQuestion = $('#question'+qID+''); $('table.subquestion-list', thisQuestion).after('<input type="button" style="float:right;" value="Reset Question" class="resetQuestionButton" />'); $('#question'+qID+' .resetQuestionButton').click(function(e){ $('input.radio', thisQuestion).prop('checked', false); }); } }); </script>