- Posts: 19
- 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(){ 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[type="radio"]', thisQuestion).prop('checked', false); }); } }); </script>
<script type="text/javascript" charset="utf-8"> $(document).on('ready pjax:scriptcomplete',function(){ var thisQuestion = $('#question{QID}'); // Insert the reset buttons $('table.subquestion-list .answertext', thisQuestion).append('<div><button type="button" class="btn btn-sm btn-primary inserted-reset">Reset row</button></div>'); // Listener on the reset buttons $('.inserted-reset', thisQuestion).on('click', function(e) { var thisRow = $(this).closest('tr'); $('input:radio', thisRow).prop('checked', false); checkconditions('', $('input:radio:eq(0)', thisRow).attr('name'), 'radio'); }); }); </script>