- Posts: 38
- Thank you received: 0
Ask the community, share ideas, and connect with other LimeSurvey users!
function removeAnswerText(qID) { // Identify some stuff var thisQuestion = $('#question'+qID); var thisArray = $('table.questions-list', thisQuestion); // Only if all row labels are empty var labelsWithText = $('th.answertext', thisArray).filter(function(i) {return $.trim($(this).text()) != '';}).length if(labelsWithText == 0) { // Add a class to the question thisQuestion.addClass('without-answertext'); // Remove the first column $('.col-answers, thead td:eq(0), th.answertext', thisArray).remove(); //Reset the column widths $('col', thisArray).attr('width', 100/$('col', thisArray).length+'%'); } }
<script type="text/javascript" charset="utf-8"> $(document).ready(function(){ removeAnswerText({QID}); }); </script>
function removeAnswerText(qID) { // Identify some stuff var thisQuestion = $('#question'+qID); var thisArray = $('table.questions-list', thisQuestion); // Only if all row labels are empty var labelsWithText = $('th.answertext', thisArray).filter(function(i) {return $.trim($(this).text()) != '';}).length if(labelsWithText == 0) { // Add a class to the question thisQuestion.addClass('without-answertext'); // Remove the first column $('.col-answers, thead tr:eq(0) > *:eq(0), th.answertext', thisArray).remove(); //Reset the column widths $('col', thisArray).attr('width', 100/$('col', thisArray).length+'%'); } }