- Posts: 222
- Thank you received: 10
Ask the community, share ideas, and connect with other LimeSurvey users!
<script charset="utf-8" type="text/javascript"> $(document).ready(function() { $('#question{QID} li.question-item.answer-item.checkbox-item:eq(0)').css ({ 'display': 'none' }); }); </script>
<script charset="utf-8" type="text/javascript"> $(document).ready(function() { $( '#question{QID} li.row.checkbox-text-item.form-group:eq(0)').css ({ 'display': 'none' }); }); </script>
<script type="text/javascript" charset="utf-8"> $(document).ready(function() { $('#question{QID} .answers-list li:eq(0)').hide(); }); </script>
tpartner wrote: The HTML structure has changed in 3.x. This should work for both question types:
Code:<script type="text/javascript" charset="utf-8"> $(document).ready(function() { $('#question{QID} .answers-list li:eq(0)').hide(); }); </script>
</script> <script type="text/javascript" charset="utf-8"> $(document).ready(function() { $('#question{QID} .answers-list li:eq(0) input.checkbox').hide(); }); </script>
I would like to hide certain checkboxes, keeping the labels and the last checkbox, which is a "Do not know" exclusive answer choice.
<script type="text/javascript" charset="utf-8"> $(document).ready(function() { $('#question{QID} .answers-list li:eq(0)').addClass('hidden-checkbox'); }); </script>
.hidden-checkbox label::before, .hidden-checkbox label::after { display: none; }
In multiple choice with comments I will hide the comment box for the "Do not know" exclusive answer.
<script type="text/javascript" charset="utf-8"> $(document).ready(function() { $('#question{QID} .answers-list li:last input:text').hide(); }); </script>
.checkbox-text-item.hidden-checkbox .checkbox-item, .checkbox-text-item.hidden-checkbox .checkbox-item label { padding-left: 0; }
<script type="text/javascript" charset="utf-8"> $(document).ready(function() { $('#question{QID} .answers-list li:eq(0) input:checkbox').addClass('invisible'); }); </script>
I have tried this code, but adding the invisible class didn't hide the checkbox.DenisChenu wrote: Question :
Did you try?Code:<script type="text/javascript" charset="utf-8"> $(document).ready(function() { $('#question{QID} .answers-list li:eq(0) input:checkbox').addClass('invisible'); }); </script>