- Posts: 146
- Thank you received: 2
Ask the community, share ideas, and connect with other LimeSurvey users!
Please Log in to join the conversation.
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse:collapse;"> <tbody> <tr> <td style="text-align: center;" width="20%"> </td> <td style="text-align: center;" width="0%"> </td> <td bgcolor="#D4D7E4" style="text-align: center;width:35%"><span style="color:#c0392b;"><span style="font-size:24px;"><strong>A</strong></span></span></td> <td style="text-align: center;" width="0%"> </td> <td bgcolor="#D4D7E4" style="text-align: center;width:35%"><span style="color:#c0392b;"><span style="font-size:24px;"><strong>B</strong></span></span></td> </tr> <tr class="rand" style="border-top:5px solid white"> <td bgcolor="#F2F2F2" style="text-align: left;"><font color="#000000"><span style="font-size: 20px;"><b>Honor</b></span></font></td> <td style="text-align: center;" width="0%"> </td> <td bgcolor="#F2F2F2" style="text-align: center;"><strong><span style="color:#000000;"><span style="font-size:20px;">diligent</span></span></strong></td> <td style="text-align: center;" width="0%"> </td> <td bgcolor="#F2F2F2" style="text-align: center;"><strong><span style="color:#000000;"><span style="font-size:20px;">outstanding</span></span></strong></td> </tr> <tr class="rand" style="border-top:5px solid white"> <td bgcolor="#F2F2F2" style="text-align: left;"><strong><span style="color:#000000;"><span style="font-size:20px;">Father's job</span></span></strong></td> <td style="text-align: center;" width="0%"> </td> <td bgcolor="#F2F2F2" style="text-align: center;"><strong><span style="color:#000000;"><span style="font-size:20px;">engineer</span></span></strong></td> <td style="text-align: center;" width="0%"> </td> <td bgcolor="#F2F2F2" style="text-align: center;"><strong><span style="color:#000000;"><span style="font-size:20px;">teacher</span></span></strong></td> </tr> <tr class="rand" style="border-top:5px solid white"> <td bgcolor="#F2F2F2" style="text-align: left;"><strong><span style="color:#000000;"><span style="font-size:20px;">Grassroots experience</span></span></strong></td> <td style="text-align: center;" width="1%"> </td> <td bgcolor="#F2F2F2" style="text-align: center;"><strong><span style="color:#000000;"><span style="font-size:20px;">freshman</span></span></strong></td> <td style="text-align: center;" width="1%"> </td> <td bgcolor="#F2F2F2" style="text-align: center;"><strong><span style="color:#000000;"><span style="font-size:20px;">administration</span></span></strong></td> </tr> <tr class="rand" style="border-top:5px solid white"> <td bgcolor="#F2F2F2" style="text-align: left;"><strong><span style="color:#000000;"><span style="font-size:20px;">status</span></span></strong></td> <td style="text-align: center;" width="1%"> </td> <td bgcolor="#F2F2F2" style="text-align: center;"><strong><span style="color:#000000;"><span style="font-size: 20px;">dependent</span></span></strong></td> <td style="text-align: center;" width="1%"> </td> <td bgcolor="#F2F2F2" style="text-align: center;"><strong><span style="color:#000000;"><span style="font-size: 20px;">independent</span></span></strong></td> </tr> <tr class="rand" style="border-top:5px solid white"> <td bgcolor="#F2F2F2" style="text-align: left;"><strong><span style="color:#000000;"><span style="font-size: 20px;">Graduated from</span></span></strong></td> <td style="text-align: center;" width="1%"> </td> <td bgcolor="#F2F2F2" style="text-align: center;"><strong><span style="color:#000000;"><span style="font-size:20px;">top university</span></span></strong></td> <td style="text-align: center;" width="1%"> </td> <td bgcolor="#F2F2F2" style="text-align: center;"><strong><span style="color:#000000;"><span style="font-size:20px;">local college</span></span></strong></td> </tr> <tr class="rand" style="border-top:5px solid white"> <td bgcolor="#F2F2F2" style="text-align: left;"><strong><span style="color:#000000;"><span style="font-size: 20px;">Gender</span></span></strong></td> <td style="text-align: center;" width="1%"> </td> <td bgcolor="#F2F2F2" style="text-align: center;"><strong><span style="color:#000000;"><span style="font-size:20px;">male</span></span></strong></td> <td style="text-align: center;" width="1%"> </td> <td bgcolor="#F2F2F2" style="text-align: center;"><strong><span style="color:#000000;"><span style="font-size:20px;">female</span></span></strong></td> </tr> <tr class="rand" style="border-top:5px solid white"> <td bgcolor="#F2F2F2" style="text-align: left;"><font color="#000000"><span style="font-size: 20px;"><b>Education</b></span></font></td> <td style="text-align: center;" width="1%"> </td> <td bgcolor="#F2F2F2" style="text-align: center;"><strong><span style="color:#000000;"><span style="font-size:20px;">master</span></span></strong></td> <td style="text-align: center;" width="1%"> </td> <td bgcolor="#F2F2F2" style="text-align: center;"><strong><span style="color:#000000;"><span style="font-size:20px;">bachelor</span></span></strong></td> </tr> </tbody> <tbody> <tr style="border-top:16px solid white"> <td bgcolor="#f2f2f2" style="text-align: left;"><span style="font-size:18px;"><strong>Your Choice</strong></span></td> <td style="text-align: center;" width="0%"> </td> <td bgcolor="#f2f2f2" style="text-align: center;"> </td> <td style="text-align: center;" width="0%"> </td> <td bgcolor="#f2f2f2"> </td> </tr> </tbody> </table> <script type="text/javascript" charset="utf-8"> $(document).on('ready pjax:scriptcomplete',function(){ // Identify this question var thisQuestion = $('#question{QID}'); // Move the radios $('.question-text table:eq(0) tr:last td:eq(2)', thisQuestion).append($('.subquestion-list .answers-list:eq(0) .answer-item:eq(0) *', thisQuestion)); $('.question-text table:eq(0) tr:last td:eq(4)', thisQuestion).append($('.subquestion-list .answers-list:eq(0) .answer-item:eq(1) *', thisQuestion)); // Some classes for presentation $('.question-text table:eq(0) input:radio', thisQuestion).closest('td').addClass('answer-item radio-item text-center radio'); $('.question-text table:eq(0) .radio-item label', thisQuestion).show(); // Click event on the table cells $('.question-text table:eq(0) .radio-item', thisQuestion).on('click', function(e) { $('input:radio', this).trigger('click'); }); $('.question-text table:eq(0) input:radio', thisQuestion).on('click', function(e) { e.stopPropagation(); }); // Clean-up styles $('.answer-container', thisQuestion).hide(); $('.question-text table:eq(0) .label-text', thisQuestion).remove(); $('.question-text table:eq(0) .radio-text', thisQuestion).css({ 'cursor': 'pointer' }); }); </script> <script type="text/javascript" charset="utf-8"> $(document).ready(function(){ // Get all row elements const rows = document.querySelectorAll('tr.rand'); // Remove header row const dataRows = Array.from(rows).slice(1); // Randomly sort row elements dataRows.sort(() => Math.random() - 0.5); // Remove original rows dataRows.forEach(row => row.remove()); // Insert rows in new order dataRows.forEach(row => { document.querySelector('tbody').appendChild(row); }); }); </script>
Please Log in to join the conversation.
Please Log in to join the conversation.
Please Log in to join the conversation.
Please Log in to join the conversation.
<script type="text/javascript" charset="utf-8">function shuffle(array) { var currentIndex = array.length, temporaryValue, randomIndex; // While there remain elements to shuffle... while (0 !== currentIndex) { // Pick a remaining element... randomIndex = Math.floor(Math.random() * currentIndex); currentIndex -= 1; // And swap it with the current element. temporaryValue = array[currentIndex]; array[currentIndex] = array[randomIndex]; array[randomIndex] = temporaryValue; } return array; } $(document).on('ready pjax:scriptcomplete',function(){ var numberOfRows=10; // Adapt to yout needs // Fill the array var arr = []; for (var i = 1; i <= numberOfRows; i++) { arr.push(i); } arr = shuffle(arr); $('#question{QID} input[type="text"]').val(arr); $('#question{QID}').hide(); }); </script>
Please Log in to join the conversation.