- Posts: 222
- Thank you received: 10
Ask the community, share ideas, and connect with other LimeSurvey users!
<script type="text/javascript" charset="utf-8"> $(document).on('ready pjax:scriptcomplete',function(){ // Identify the questions var qArrayID = {QID}; var qArray = $('#question'+qArrayID); var arrayLength = $('tr.answers-list', qArray).length; var qUploads = qArray.nextAll('.upload-files:lt('+arrayLength+')'); var qComments = qArray.nextAll('.text-long:lt('+arrayLength+')'); // Add some classes COMMENTS qArray.addClass('array-with-comments-question'); $(qComments).each(function(i) { $(this).addClass('comments-question index-'+i).css({ 'position': 'absolute', 'left': '-9999em' }); }); // Add some classes UPLOADS qArray.addClass('array-with-uploads-question'); $(qUploads).each(function(i) { $(this).addClass('uploads-question index-'+i).css({ 'position': 'absolute', 'left': '-9999em' }); }); // Insert the comments buttons $('table.questions-list colgroup', qArray).append('<col />'); var tableWidth = $('table.questions-list:eq(0)', qArray).width(); var answerWidth = $('col.ls-col-odd:eq(0)', qArray).width(); var answerWidthPercent = (answerWidth/tableWidth)*100; var answersLength = $('col.ls-col-odd, col.ls-col-even', qArray).length; var answerWidthPercent2 = (answerWidthPercent*answersLength)/(answersLength+1) $('table.questions-list col', qArray).removeAttr('width'); $('table.questions-list col:not(.col-answers)', qArray).css('width', answerWidthPercent2+'%'); $('table.questions-list col:not(.col-answers)', qArray).css('width', 'auto'); $('table.questions-list thead tr', qArray).append('<td />'); $('tr.answers-list', qArray).each(function(i) { $(this).append('<td class="answer-item">\ <button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#comments-'+qArrayID+'-'+(i+1)+'" data-backdrop="static" data-keyboard="false">WebLink</button>\ </td>'); }); // Insert the "Upload" buttons $('table.questions-list colgroup', qArray).append('<col />'); var tableWidth = $('table.questions-list:eq(0)', qArray).width(); var answerWidth = $('col.ls-col-odd:eq(0)', qArray).width(); var answerWidthPercent = (answerWidth/tableWidth)*100; var answersLength = $('col.ls-col-odd, col.ls-col-even', qArray).length; var answerWidthPercent2 = (answerWidthPercent*answersLength)/(answersLength+1) $('table.questions-list col', qArray).removeAttr('width'); $('table.questions-list col:not(.col-answers)', qArray).css('width', answerWidthPercent2+'%'); $('table.questions-list col:not(.col-answers)', qArray).css('width', 'auto'); $('table.questions-list thead tr', qArray).append('<td />'); $('tr.answers-list', qArray).each(function(i) { $(this).append('<td class="answer-item">\ <button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#upload-'+qArrayID+'-'+(i+1)+'" data-backdrop="static" data-keyboard="false">Upload</button>\ </td>'); }); // Loop through the upload questions $(qUploads).each(function(i) { // Create a modal $('body').append('<div class="modal upload-modal" id="upload-'+qArrayID+'-'+(i+1)+'" tabindex="-1" role="dialog">\ <div class="modal-dialog" role="document">\ <div class="modal-content">\ <div class="modal-header">\ <h5 class="modal-title">'+$('.ls-label-question', this).html()+'</h5>\ </div>\ <div class="modal-body">\ </div>\ <div class="modal-footer">\ <button type="button" class="btn btn-primary" data-bs-dismiss="modal">Okay</button>\ </div>\ </div>\ </div>\ </div>'); // Move this question into the modal $('#upload-'+qArrayID+'-'+(i+1)+' .modal-body').append($(this)); $(this).css({ 'position': 'relative', 'left': 'auto' }); }); // Handle comments $(qComments).each(function(i) { // Create modals $('body').append('<div class="modal comments-modal" id="comments-'+qArrayID+'-'+(i+1)+'" tabindex="-1" role="dialog">\ <div class="modal-dialog" role="document">\ <div class="modal-content">\ <div class="modal-header">\ <h5 class="modal-title">'+$('.ls-label-question', this).html()+'</h5>\ </div>\ <div class="modal-body">\ </div>\ <div class="modal-footer">\ <button type="button" class="btn btn-primary" data-bs-dismiss="modal">Okay</button>\ <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Clear</button>\ </div>\ </div>\ </div>\ </div>'); // Move textareas into modals $('#comments-'+qArrayID+'-'+(i+1)+' .modal-body').append($('textarea', this)); // Modal button events $('#comments-'+qArrayID+'-'+(i+1)+' .modal-footer .btn-secondary').on('click', function(e) { $('#comments-'+qArrayID+'-'+(i+1)+' textarea').val(''); }); }); // Interrupt the Next/Submit function (to put upload questions back in the form) $('#ls-button-submit').on('click', function(e) { $('.upload-modal').each(function(i) { $('.upload-files', this).css({ 'position': 'absolute', 'left': '-9999em' }); $('.group-container').append($('.upload-files', this)); }); }); // Interrupt the Next/Submit function (to put comments back in the form) $('#ls-button-submit').on('click', function(e) { $('.comments-modal').each(function(i) { var qID = $('textarea:eq(0)', this).attr('id').split('X')[2]; $('#question'+qID+' .answer-item:eq(0)').append($('textarea:eq(0)', this)); }); }); }); </script>
<script type="text/javascript" charset="utf-8"> $(document).on('ready pjax:scriptcomplete',function(){ // Identify the questions var qArrayID = {QID}; var qArray = $('#question'+qArrayID); var arrayLength = $('tr.answers-list', qArray).length; var qUploads = qArray.nextAll('.upload-files:lt('+arrayLength+')'); var qMultiText = qArray.nextAll('.multiple-short-txt:eq(0)'); // Add some classes qArray.addClass('array-with-uploads-question'); $(qUploads).each(function(i) { $(this).addClass('uploads-question index-'+i).css({ 'position': 'absolute', 'left': '-9999em' }); }); // Hide the multi-short-text question $(qMultiText).hide(); // Insert the "Upload" buttons and a column for the text inputs $('table.questions-list colgroup', qArray).append('<col />'); var tableWidth = $('table.questions-list:eq(0)', qArray).width(); var answerWidth = $('col.ls-col-odd:eq(0)', qArray).width(); var answerWidthPercent = (answerWidth/tableWidth)*100; var answersLength = $('col.ls-col-odd, col.ls-col-even', qArray).length; var answerWidthPercent2 = (answerWidthPercent*answersLength)/(answersLength+2) $('table.questions-list col', qArray).removeAttr('width'); $('table.questions-list col:not(.col-answers)', qArray).css('width', answerWidthPercent2+'%'); $('table.questions-list col:not(.col-answers)', qArray).css('width', 'auto'); $('table.questions-list thead tr', qArray).append('<th class="answer-text inserted-column-label" /><td />'); $('tr.answers-list', qArray).each(function(i) { $(this).append('<td class="answer-item text-item">\ </td>\ <td class="answer-item">\ <button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#upload-'+qArrayID+'-'+(i+1)+'" data-backdrop="static" data-keyboard="false">Upload</button>\ </td>'); }); // Load the column label for the text inputs $('.inserted-column-label:eq(0)', qArray).text($('.ls-label-question', qMultiText).text()); $('.text-item', qArray).prepend('<label class="ls-label-xs-visibility">'+$('.ls-label-question', qMultiText).text()+'</label>') // Loop through the multi-short-text sub-questions $('li.answer-item', qMultiText).each(function(i) { // Move the text inputs into the array $('input[type="text"]', this).appendTo($('tr.answers-list:eq('+i+') .text-item', qArray)); }); // Loop through the upload questions $(qUploads).each(function(i) { // Create a modal $('body').append('<div class="modal upload-modal" id="upload-'+qArrayID+'-'+(i+1)+'" tabindex="-1" role="dialog">\ <div class="modal-dialog" role="document">\ <div class="modal-content">\ <div class="modal-header">\ <h5 class="modal-title">'+$('.ls-label-question', this).html()+'</h5>\ </div>\ <div class="modal-body">\ </div>\ <div class="modal-footer">\ <button type="button" class="btn btn-primary" data-bs-dismiss="modal">Okay</button>\ </div>\ </div>\ </div>\ </div>'); // Move this question into the modal $('#upload-'+qArrayID+'-'+(i+1)+' .modal-body').append($(this)); $(this).css({ 'position': 'relative', 'left': 'auto' }); }); // Interrupt the Next/Submit function (to put upload questions back in the form) $('#ls-button-submit').on('click', function(e) { $('.upload-modal').each(function(i) { $('.upload-files', this).css({ 'position': 'absolute', 'left': '-9999em' }); $('.group-container').append($('.upload-files', this)); }); }); }); </script>
$('table.questions-list thead tr', qArray).append('<th class="answer-text inserted-column-label" /><td />'); $('tr.answers-list', qArray).each(function(i) { $(this).append('<td class="answer-item text-item">\ </td>\ <td class="answer-item">\ <button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#upload-'+qArrayID+'-'+(i+1)+'" data-backdrop="static" data-keyboard="false">Upload</button>\ </td>'); });
$('table.questions-list thead th.answer-text:eq(0)', qArray).after('<th class="answer-text inserted-column-label" /><td />'); $('tr.answers-list', qArray).each(function(i) { $('.answer-item:eq(0)', this).after('<td class="answer-item text-item">\ </td>\ <td class="answer-item">\ <button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#upload-'+qArrayID+'-'+(i+1)+'" data-backdrop="static" data-keyboard="false">Upload</button>\ </td>'); });
Nope, I just did that for appearance.BTW I've also noticed that you've set the the sub-question width to 20%. Is that required for this workaround? I've reset it and didn't notice any change in the appearance.
$('table.questions-list thead th.answer-text:eq(1)', qArray).after('<th class="answer-text inserted-column-label" /><td />'); $('tr.answers-list', qArray).each(function(i) { $('.answer-item:eq(1)', this).after('<td class="answer-item text-item">\ </td>\ <td class="answer-item">\ <button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#upload-'+qArrayID+'-'+(i+1)+'" data-backdrop="static" data-keyboard="false">Upload</button>\ </td>');
var qMultiText2 = qArray.nextAll('.multiple-short-txt:eq(1)'); $(qMultiText2).hide();
<script type="text/javascript" charset="utf-8"> $(document).on('ready pjax:scriptcomplete',function(){ // Identify the questions var qArrayID = {QID}; var qArray = $('#question'+qArrayID); var arrayLength = $('tr.answers-list', qArray).length; var qUploads = qArray.nextAll('.upload-files:lt('+arrayLength+')'); var qMultiText = qArray.nextAll('.multiple-short-txt:eq(0)'); var qMultiText2 = qArray.nextAll('.multiple-short-txt:eq(1)'); // Add some classes qArray.addClass('array-with-uploads-question'); $(qUploads).each(function(i) { $(this).addClass('uploads-question index-'+i).css({ 'position': 'absolute', 'left': '-9999em' }); }); // Hide the multi-short-text questions $(qMultiText).hide(); $(qMultiText2).hide(); // Re-define some table widths $('table.questions-list colgroup', qArray).append('<col />'); var tableWidth = $('table.questions-list:eq(0)', qArray).width(); var answerWidth = $('col.ls-col-odd:eq(0)', qArray).width(); var answerWidthPercent = (answerWidth/tableWidth)*100; var answersLength = $('col.ls-col-odd, col.ls-col-even', qArray).length; var answerWidthPercent2 = (answerWidthPercent*answersLength)/(answersLength+2) $('table.questions-list col', qArray).removeAttr('width'); $('table.questions-list col:not(.col-answers)', qArray).css('width', answerWidthPercent2+'%'); $('table.questions-list col:not(.col-answers)', qArray).css('width', 'auto'); // Insert the "Upload" buttons and a column for the "Weblink" inputs $('table.questions-list thead th.answer-text:eq(1)', qArray).after('<th class="answer-text inserted-column-label" /><th class="answer-text inserted-column-label" />'); $('tr.answers-list', qArray).each(function(i) { $('.answer-item:eq(1)', this).after('<td class="answer-item text-item">\ </td>\ <td class="answer-item">\ <button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#upload-'+qArrayID+'-'+(i+1)+'" data-backdrop="static" data-keyboard="false">Upload</button>\ </td>'); }); // Load the column labels $('.inserted-column-label:eq(0)', qArray).text($('.ls-label-question', qMultiText).text()); $('.text-item:nth-child(4)', qArray).prepend('<label class="ls-label-xs-visibility">'+$('.ls-label-question', qMultiText).text()+'</label>'); $('.inserted-column-label:eq(1)', qArray).text('Upload'); // Loop through the first multi-short-text sub-questions $('li.answer-item', qMultiText).each(function(i) { // Move the text inputs into the array $('input[type="text"]', this).appendTo($('tr.answers-list:eq('+i+') .text-item', qArray)); }); // Loop through the second multi-short-text sub-questions $('li.answer-item', qMultiText2).each(function(i) { // Move the text inputs into the array (leaving the radios in that column in place) $('input[type="text"]', this).appendTo($('tr.answers-list:eq('+i+') .radio-item:nth-child(7)', qArray)); }); // Hide the radios in the "other" column $('tr.answers-list .answer-item:nth-child(7)', qArray).removeClass('radio-item').addClass('text-item other-item'); $('tr.answers-list .answer-item:nth-child(7) input[type="radio"]', qArray).css({ 'position': 'absolute', 'left': '-9999em' }); // Loop through the upload questions $(qUploads).each(function(i) { // Create a modal $('body').append('<div class="modal upload-modal" id="upload-'+qArrayID+'-'+(i+1)+'" tabindex="-1" role="dialog">\ <div class="modal-dialog" role="document">\ <div class="modal-content">\ <div class="modal-header">\ <h5 class="modal-title">'+$('.ls-label-question', this).html()+'</h5>\ </div>\ <div class="modal-body">\ </div>\ <div class="modal-footer">\ <button type="button" class="btn btn-primary" data-bs-dismiss="modal">Okay</button>\ </div>\ </div>\ </div>\ </div>'); // Move this question into the modal $('#upload-'+qArrayID+'-'+(i+1)+' .modal-body').append($(this)); $(this).css({ 'position': 'relative', 'left': 'auto' }); }); // Listeners on the "Other" text inputs $('.other-item input[type="text"]', qArray).on('keyup change', function(e) { var thisRadio = $(this).closest('.answer-item').find('input[type="radio"]'); var radioValue = ''; if($.trim($(this).val()) != '') { $(thisRadio).trigger('click'); radioValue = $(thisRadio).val(); } else { $(thisRadio).prop('checked', false); } checkconditions(radioValue, $(thisRadio).attr('name'), $(thisRadio).attr('type')); }); // Listeners on the "Do not know" radios $('.answer-item:nth-child(8) input[type="radio"]', qArray).on('click', function(e) { var thisRow = $(this).closest('.answers-list'); // Clear the text inputs in this row $('input[type="text"]', thisRow).val(''); }); // Interrupt the Next/Submit function (to put upload questions back in the form) $('#ls-button-submit').on('click', function(e) { $('.upload-modal').each(function(i) { $('.upload-files', this).css({ 'position': 'absolute', 'left': '-9999em' }); $('.group-container').append($('.upload-files', this)); }); }); }); </script>
tpartner wrote: To move the columns, change this:
Code:$('table.questions-list thead tr', qArray).append('<th class="answer-text inserted-column-label" /><td />'); $('tr.answers-list', qArray).each(function(i) { $(this).append('<td class="answer-item text-item">\ </td>\ <td class="answer-item">\ <button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#upload-'+qArrayID+'-'+(i+1)+'" data-backdrop="static" data-keyboard="false">Upload</button>\ </td>'); });
To this:
Code:$('table.questions-list thead th.answer-text:eq(0)', qArray).after('<th class="answer-text inserted-column-label" /><td />'); $('tr.answers-list', qArray).each(function(i) { $('.answer-item:eq(0)', this).after('<td class="answer-item text-item">\ </td>\ <td class="answer-item">\ <button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#upload-'+qArrayID+'-'+(i+1)+'" data-backdrop="static" data-keyboard="false">Upload</button>\ </td>'); });
Sample survey attached:
// Listeners on the "Do not know" radios $('.answer-item:nth-child(6) input[type="radio"]', qArray).on('click', function(e) { var thisRow = $(this).closest('.answers-list'); // Clear the text inputs in this row $('input[type="text"]', thisRow).val(''); });
$('.inserted-column-label:eq(1)', qArray).text('Upload');
tpartner wrote: Wow, this is getting pretty complex.
<script type="text/javascript" charset="utf-8"> $(document).on('ready pjax:scriptcomplete',function(){ // Identify the questions var qArrayID = {QID}; var qArray = $('#question'+qArrayID); var arrayLength = $('tr.answers-list', qArray).length; var qUploads = qArray.nextAll('.upload-files:lt('+arrayLength+')'); var qMultiText = qArray.nextAll('.multiple-short-txt:eq(0)'); var qMultiText2 = qArray.nextAll('.multiple-short-txt:eq(1)'); // Add some classes qArray.addClass('array-with-uploads-question'); $(qUploads).each(function(i) { $(this).addClass('uploads-question index-'+i).css({ 'position': 'absolute', 'left': '-9999em' }); }); // Hide the multi-short-text questions $(qMultiText).hide(); $(qMultiText2).hide(); // Re-define some table widths $('table.questions-list colgroup', qArray).append('<col />'); var tableWidth = $('table.questions-list:eq(0)', qArray).width(); var answerWidth = $('col.ls-col-odd:eq(0)', qArray).width(); var answerWidthPercent = (answerWidth/tableWidth)*100; var answersLength = $('col.ls-col-odd, col.ls-col-even', qArray).length; var answerWidthPercent2 = (answerWidthPercent*answersLength)/(answersLength+2) $('table.questions-list col', qArray).removeAttr('width'); $('table.questions-list col:not(.col-answers)', qArray).css('width', answerWidthPercent2+'%'); $('table.questions-list col:not(.col-answers)', qArray).css('width', 'auto'); // Insert the "Upload" buttons and a column for the "Weblink" inputs $('tr.ls-heading', qArray).each(function(i) { $('th.answer-text:eq(1)', this).after('<th class="answer-text inserted-column-label" /><th class="answer-text inserted-column-label" />'); }); $('tr.answers-list', qArray).each(function(i) { $('.answer-item:eq(1)', this).after('<td class="answer-item text-item">\ </td>\ <td class="answer-item">\ <button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#upload-'+qArrayID+'-'+(i+1)+'" data-backdrop="static" data-keyboard="false">Upload</button>\ </td>'); }); // Load the column labels $('tr.ls-heading', qArray).each(function(i) { $('.inserted-column-label:eq(0)', this).text($('.ls-label-question', qMultiText).text()); $('.inserted-column-label:eq(1)', this).text('Upload'); }); $('.text-item:nth-child(4)', qArray).prepend('<label class="ls-label-xs-visibility">'+$('.ls-label-question', qMultiText).text()+'</label>'); // Loop through the first multi-short-text sub-questions $('li.answer-item', qMultiText).each(function(i) { // Move the text inputs into the array $('input[type="text"]', this).appendTo($('tr.answers-list:eq('+i+') .text-item', qArray)); }); // Loop through the second multi-short-text sub-questions $('li.answer-item', qMultiText2).each(function(i) { // Move the text inputs into the array (leaving the radios in that column in place) $('input[type="text"]', this).appendTo($('tr.answers-list:eq('+i+') .radio-item:nth-child(7)', qArray)); }); // Hide the radios in the "other" column $('tr.answers-list .answer-item:nth-child(7)', qArray).removeClass('radio-item').addClass('text-item other-item'); $('tr.answers-list .answer-item:nth-child(7) input[type="radio"]', qArray).css({ 'position': 'absolute', 'left': '-9999em' }); // Loop through the upload questions $(qUploads).each(function(i) { // Create a modal $('body').append('<div class="modal upload-modal" id="upload-'+qArrayID+'-'+(i+1)+'" tabindex="-1" role="dialog">\ <div class="modal-dialog" role="document">\ <div class="modal-content">\ <div class="modal-header">\ <h5 class="modal-title">'+$('.ls-label-question', this).html()+'</h5>\ </div>\ <div class="modal-body">\ </div>\ <div class="modal-footer">\ <button type="button" class="btn btn-primary" data-bs-dismiss="modal">Okay</button>\ </div>\ </div>\ </div>\ </div>'); // Move this question into the modal $('#upload-'+qArrayID+'-'+(i+1)+' .modal-body').append($(this)); $(this).css({ 'position': 'relative', 'left': 'auto' }); }); // Listeners on the "Other" text inputs $('.other-item input[type="text"]', qArray).on('keyup change', function(e) { var thisRadio = $(this).closest('.answer-item').find('input[type="radio"]'); var radioValue = ''; if($.trim($(this).val()) != '') { $(thisRadio).trigger('click'); radioValue = $(thisRadio).val(); } else { $(thisRadio).prop('checked', false); } checkconditions(radioValue, $(thisRadio).attr('name'), $(thisRadio).attr('type')); }); // Listeners on the "Do not know" radios $('.answer-item:nth-child(8) input[type="radio"]', qArray).on('click', function(e) { var thisRow = $(this).closest('.answers-list'); // Clear the text inputs in this row $('input[type="text"]', thisRow).val(''); }); // Interrupt the Next/Submit function (to put upload questions back in the form) $('#ls-button-submit').on('click', function(e) { $('.upload-modal').each(function(i) { $('.upload-files', this).css({ 'position': 'absolute', 'left': '-9999em' }); $('.group-container').append($('.upload-files', this)); }); }); }); </script>
tpartner wrote: This script will place the Upload type questions in modals:
Code:<script type="text/javascript" charset="utf-8"> $(document).on('ready pjax:scriptcomplete',function(){ // Identify the questions var qArrayID = {QID}; var qArray = $('#question'+qArrayID); var arrayLength = $('tr.answers-list', qArray).length; var qUploads = qArray.nextAll('.upload-files:lt('+arrayLength+')'); // Add some classes qArray.addClass('array-with-uploads-question'); $(qUploads).each(function(i) { $(this).addClass('uploads-question index-'+i).css({ 'position': 'absolute', 'left': '-9999em' }); }); // Insert the "Upload" buttons $('table.questions-list colgroup', qArray).append('<col />'); var tableWidth = $('table.questions-list:eq(0)', qArray).width(); var answerWidth = $('col.ls-col-odd:eq(0)', qArray).width(); var answerWidthPercent = (answerWidth/tableWidth)*100; var answersLength = $('col.ls-col-odd, col.ls-col-even', qArray).length; var answerWidthPercent2 = (answerWidthPercent*answersLength)/(answersLength+1) $('table.questions-list col', qArray).removeAttr('width'); $('table.questions-list col:not(.col-answers)', qArray).css('width', answerWidthPercent2+'%'); $('table.questions-list col:not(.col-answers)', qArray).css('width', 'auto'); $('table.questions-list thead tr', qArray).append('<td />'); $('tr.answers-list', qArray).each(function(i) { $(this).append('<td class="answer-item">\ <button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#upload-'+qArrayID+'-'+(i+1)+'" data-backdrop="static" data-keyboard="false">Upload</button>\ </td>'); }); // Loop through the upload questions $(qUploads).each(function(i) { // Create a modal $('body').append('<div class="modal upload-modal" id="upload-'+qArrayID+'-'+(i+1)+'" tabindex="-1" role="dialog">\ <div class="modal-dialog" role="document">\ <div class="modal-content">\ <div class="modal-header">\ <h5 class="modal-title">'+$('.ls-label-question', this).html()+'</h5>\ </div>\ <div class="modal-body">\ </div>\ <div class="modal-footer">\ <button type="button" class="btn btn-primary" data-bs-dismiss="modal">Okay</button>\ </div>\ </div>\ </div>\ </div>'); // Move this question into the modal $('#upload-'+qArrayID+'-'+(i+1)+' .modal-body').append($(this)); $(this).css({ 'position': 'relative', 'left': 'auto' }); }); // Interrupt the Next/Submit function (to put upload questions back in the form) $('#ls-button-submit').on('click', function(e) { $('.upload-modal').each(function(i) { $('.upload-files', this).css({ 'position': 'absolute', 'left': '-9999em' }); $('.group-container').append($('.upload-files', this)); }); }); }); </script>
Sample survey attached: