- 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 qID = '{QID}'; var thisQuestion = $('#question'+qID); var textQuestion = thisQuestion.nextAll('.multiple-short-txt:eq(0)'); // Hide the multiple-short-text textQuestion.hide(); // Move the text inputs $('tr[id^="javatbd"]', thisQuestion).each(function (i) { $('td:last', this).addClass('text-item with-inserted-text').append($('li[id^="javatbd"]:eq('+i+') :text', textQuestion)); }); // A listener on the checkboxes $('td.checkbox-item.text-item input[type="text"]', thisQuestion).on('change keyup', function (event) { handleText($(this)); }); function handleText(thisInput) { var thisCell = $(thisInput).closest('td'); if($.trim($(thisInput).val()) != '') { $('input:hidden', thisCell).val('1'); $('input:checkbox', thisCell).prop('checked', true).trigger('change'); } else { $('input:hidden', thisCell).val(''); $('input:checkbox', thisCell).prop('checked', false).trigger('change'); } } }); </script>
<style type="text/css" data-author="Tony Partner"> .dir-ltr .ls-answers td.checkbox-item.with-inserted-text { padding: 4px; } td.with-inserted-text label::before, td.with-inserted-text label::after { display: none; } @media only screen and (min-width: 768px) { .dir-ltr .ls-answers td.checkbox-item.with-inserted-text { padding: 8px 3px; } .dir-ltr .ls-answers td.with-inserted-text label { display: none; } } </style>
Please Log in to join the conversation.