- Posts: 8
- Thank you received: 0
Ask the community, share ideas, and connect with other LimeSurvey users!
<script type="text/javascript" charset="utf-8"> $(document).on('ready pjax:scriptcomplete',function(){ var thisQuestion = $('#question{QID}'); // Initially hide all but the first row $('tr.answers-list:gt(0)', thisQuestion).hide(); // Listener on the radios $('input:radio', thisQuestion).on('click', function(e) { var thisRow = $(this).closest('tr'); var nextRow = $(thisRow).next('tr.answers-list'); console.log(nextRow) if(nextRow.length > 0) { // Hide this row and show the next $(thisRow).fadeOut(300, function(e) { $(nextRow).fadeIn(300); }); } else { // No next row so hide the table $('table.ls-answers', thisQuestion).fadeOut(300); } }); }); </script>
<button onclick="showpreviousRow();" style="float: right;" type="button"> Check your previous response </button> <script type="text/javascript" charset="utf-8"> function showpreviousRow() { var thisQuestion = $('#question{QID}'); $('tr.answers-list:gt(0)', thisQuestion).show(); // Initially hide all but the first row var currentRow = $('tr.answers-list', thisQuestion).closest('tr'); var prevRow = $(currentRow).prev('tr.answers-list'); $(currentRow).fadeOut(300, function(e) { $(prevRow).fadeIn(300); }); } </script></p>
Please Log in to join the conversation.
Please Log in to join the conversation.
$('tr.answers-list', thisQuestion).closest('tr');
Please Log in to join the conversation.
Please Log in to join the conversation.
Please Log in to join the conversation.