Welcome to the LimeSurvey Community Forum

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

How to hide certain comment boxes for multiple choice with comment

  • maxersloan
  • maxersloan's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
8 years 10 months ago #122035 by maxersloan
Back in 2013 I did a survey in 1.9 that I'm now trying to replicate on 2.0 but it looks like some code that I used in the template.css no longer works. I am trying to hide all of the boxes except the 2 beside the options with "please specify" in parentheses (see screenshot). I was using this code at the bottom of my template.css but it's not working:
Code:
#answer916916X22XQ221comment {display: none;}
#answer916916X22XQ222comment {display: none;}
#answer916916X22XQ223comment {display: none;}
#answer916916X22XQ224comment {display: none;}
#answer916916X22XQ226comment {display: none;}
#answer916916X22XQ227comment {display: none;}
#answer916916X22XQ228comment {display: none;}
#answer916916X22XQ229comment {display: none;}
#answer916916X22XQ2210comment {display: none;}
#answer916916X22XQ2211comment {display: none;}
#answer916916X22XQ2212comment {display: none;}
#answer916916X22XQ2214comment {display: none;}

I also tried using periods instead of # but still no luck. Any advice? I'm using a copy of the default template
The topic has been locked.
More
8 years 10 months ago - 8 years 10 months ago #122045 by LSdev
Lets say I want to hide answer code a and b;



then my code would be as below. Please adapt. You have to place this code in question text source code.
Code:
<script type="text/javascript" charset="utf-8">  
  $(document).ready(function() {    
 
 
    var codesToHide = ['a','b']; //add answer codes to hide here. 
 
    for (var i = 0; i < codesToHide.length; i++) {
      $('#answer{SGQ}'+codesToHide[i]+'').parent().parent().find('input:text').hide();
    };
 
    });
</script>
Attachments:
Last edit: 8 years 10 months ago by LSdev. Reason: typo
The following user(s) said Thank You: maxersloan
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose