- Posts: 61
- 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(){ // Identify the questions var thisQID = {QID}; var thisQuestion = $('#question'+thisQID); var textQuestion = thisQuestion.nextAll('.multiple-short-txt:eq(0)'); var textQID = textQuestion.attr('id').replace(/question/, ''); // Hide the text question textQuestion.hide(); // Remove all radios from first column $('.answer-item:nth-child(2)', thisQuestion).removeClass('radio-item').addClass('text-item'); $('.answer-item:nth-child(2) :radio', thisQuestion).remove(); // Move the text inputs $('tr.answers-list', thisQuestion).each(function(i) { var thisCode = $(this).attr('id').split('X'+thisQID)[1]; $('.answer-item:nth-child(2)', this).append($(':text[id$="X'+textQID+thisCode+'"]', textQuestion)); }); }); </script>
Please Log in to join the conversation.
Please Log in to join the conversation.
<script type="text/javascript" data-author="Tony Partner"> $(document).on('ready pjax:scriptcomplete',function(){ // Identify the questions var thisQID = {QID}; var thisQuestion = $('#question'+thisQID); var textQuestion = thisQuestion.nextAll('.multiple-short-txt:eq(0)'); var textQID = textQuestion.attr('id').replace(/question/, ''); // Hide the text question textQuestion.hide(); // Remove all radios from first column $('.answer-item:nth-child(2)', thisQuestion).removeClass('radio-item').addClass('text-item'); $('.answer-item:nth-child(2) :radio', thisQuestion).remove(); // Move the text inputs $('tr.answers-list', thisQuestion).each(function(i) { var thisCode = $(this).attr('id').split('X'+thisQID)[1]; $('.answer-item:nth-child(2)', this).append($(':text[id$="X'+textQID+thisCode+'"]', textQuestion)); }); // Listener on the radios $('.radio-item :radio', thisQuestion).on('click', function(e) { $(this).closest('tr').find(':text').val('').trigger('keyup'); }); // Listener on the text inputs $('.text-item :text', thisQuestion).on('keyup change', function(e) { if($.trim($(this).val()) != '') { var thisRadio = $(this).closest('tr').find(':radio:first'); $(thisRadio).prop('checked', false); checkconditions('', $(thisRadio).attr('name'), 'radio'); } }); }); </script>
Please Log in to join the conversation.
Please Log in to join the conversation.