- Posts: 24
- Thank you received: 0
Ask the community, share ideas, and connect with other LimeSurvey users!
Please Log in to join the conversation.
<script type="text/javascript" data-author="Tony Partner"> $(document).on('ready pjax:scriptcomplete',function(){ var thisQuestion = $('#question{QID}'); var nextQuestion = $(thisQuestion).nextAll('.multiple-short-txt:eq(0)'); // Hide the next question $(nextQuestion).hide(); // Move the text inputs // First row, second column $('tr.answers-list:eq(0) .answer-item:eq(1)', thisQuestion).addClass('text-item').append($('.answer-item:eq(0) input:text', nextQuestion)); // Second row, second column $('tr.answers-list:eq(1) .answer-item:eq(1)', thisQuestion).addClass('text-item').append($('.answer-item:eq(1) input:text', nextQuestion)); // Listeners $('.answer-item input:text', thisQuestion).on('keyup', function(e) { if($.trim($(this).val()) != '') { $(this).closest('.answer-item').find(':radio').trigger('click'); } }); $('.answer-item input:radio', thisQuestion).on('click', function(e) { if($(this).closest('.answer-item').find(':text').length == 0) { $(this).closest('tr').find(':text').val('').trigger('keyup'); } }); // Cleanup styles $('.answer-item input:text', thisQuestion).css({ 'margin-left': '-10px' }); }); </script>
Please Log in to join the conversation.
Please Log in to join the conversation.