Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

Hiding specific checkboxes in multiple choice & with comments

More
4 years 3 months ago #192745 by asilbering
Hi tpartner,

I am trying to hide the text boxes for some subquestions in a multiple choice with comments question.

There are 7 "main" subquestions that should not have a comment box. These are kind of "category headings". If one of these is selected then "sub-items" are displayed, for which I would like to have a comment box, that should be mandatory if the box is checked.

A sample survey is attached.

I have tried the script you proposed with no success. (not even the last text box is hidden). Could you please give me a hint on how to proceed?

thanks in advance!


Ana
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 years 3 months ago #192747 by Joffm
Hi, Ana,
though you didn't address me, a short answer.

Your javascript to hide the comments should be:
Code:
<script type="text/javascript" charset="utf-8">
  $(document).ready(function() { 
        var thisQuestion = $('#question{QID}');
  // Remove some text inputs
    $('.checkbox-text-item:eq(0) .comment-item', thisQuestion).remove();
    $('.checkbox-text-item:eq(8) .comment-item', thisQuestion).remove();
    $('.checkbox-text-item:eq(16) .comment-item', thisQuestion).remove();
  });
</script>
You have to add the numbers of other coment-items.

You see


Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless
The topic has been locked.
More
4 years 3 months ago #192749 by asilbering
Thanks Joffm!!
That works great!

Best,

Ana
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose