Welcome to the LimeSurvey Community Forum

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

Hide comment by using the "List with comment"

More
8 years 5 months ago - 8 years 5 months ago #127238 by Perry
Hello everyone,

In question type "List with comment",
I want to hide the comment when choosing the Option A or Option B.

This could be done in JS script, like "$('.list-with-comment p.comment').hide();" don't know how to control it by condition ( choosing the Option A or Option B)
To make it like a single question, don't want to add another comment question (by using Expression to hide).

Any talent ideas?
Many thanks!
Last edit: 8 years 5 months ago by Perry.
The topic has been locked.
More
8 years 5 months ago #127239 by Perry
Well, I found a way to do that

Code:
<script type="text/javascript" charset="utf-8">
$(document).ready(function(){
// Identify this question
  var thisQuestion = $('#question{QID}');
 
// start listener
  $('input.radio', thisQuestion).on('click', function(e) {
      if($(this).attr('value') < 3) {
        $('p.answer-item',thisQuestion).show();
      }
      else {
        $('p.answer-item',thisQuestion).hide();
      }
  });
 
});
</script>
.
The following user(s) said Thank You: DenisChenu
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose