- Posts: 15
- Thank you received: 0
Ask the community, share ideas, and connect with other LimeSurvey users!
<script type="text/javascript" charset="utf-8"> $(document).ready(function() { $('#answer134729X2154X341901').attr('disabled','disabled'); //disable checkbox $('#answer134729X2154X341901').hide(); //hide the checkbox }); </script>
Shirley33 wrote: Thanks , I tried your method. But it seems that the checkbox is still visible.
<script type="text/javascript" charset="utf-8"> $(document).ready(function() { $('#answer12345X123X1231').attr('disabled','disabled'); //disable checkbox $('label[for="answer12345X123X1231"]').hide(); //hide the checkbox }); </script>
<script type="text/javascript" charset="utf-8"> $(document).ready(function() { // Identify this question var thisQuestion = $('#question{QID}'); // Hide the first 2 checkboxs and 3rd comment box $('#answer611171X1199X424181').attr('disabled','disabled'); //disable checkbox $('label[for="#answer611171X1199X424181"]').hide(); //hide the checkbox $('#answer611171X1199X424181').attr('disabled','disabled'); //disable checkbox $('label[for="#answer611171X1199X424181"]').hide(); //hide the checkbox $('#answer611171X1199X424181comment').attr('disabled','disabled'); //disable comment box $('input[for="#answer611171X1199X424181comment"]').hide(); //hide the checkbox }); </script>
<script type="text/javascript" charset="utf-8"> $(document).on('ready pjax:scriptcomplete',function(){ var thisQuestion = $('#question{QID}'); // Add classes to the first two sub-question rows $('.checkbox-text-item:lt(2)', thisQuestion).addClass('with-hidden-checkbox'); // Hide the 3rd text input $('input:text:eq(2)', thisQuestion).hide(); }); </script>
.checkbox-text-item.with-hidden-checkbox .checkbox-item, .checkbox-text-item.with-hidden-checkbox .checkbox-item label { padding-left: 0; } .checkbox-text-item.with-hidden-checkbox label:before, .checkbox-text-item.with-hidden-checkbox label:after { display: none; }