Welcome to the LimeSurvey Community Forum

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

List with comment - hiding text label

  • krosser
  • krosser's Avatar Topic Author
  • Offline
  • Elite Member
  • Elite Member
More
5 years 7 months ago #172698 by krosser
List with comment - hiding text label was created by krosser
Hey guys,

I'm trying to effectively hide the text label with a JS code.
I've written this code, which hides the label. It works but am not sure if it's really correct. So, if someone can check it out as well, I would appreciate it.
Code:
<script type="text/javascript" charset="utf-8">
$(document).on('ready pjax:scriptcomplete',function(){
 
  var thisQuestion = $('#question{QID}');
 
  $('.form-group.answer-item.text-item.col-sm-6.col-xs-12 .control-label', thisQuestion).hide();
 
})
</script>

I've also added some text inside the comment (which is why I want to hide the label in the first place).




File Attachment:

File Name: limesurvey...9968.lss
File Size:18 KB


Cheers :)

I'm using the latest LS 3.22 hosted on LS servers, not installed locally.
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 7 months ago #172704 by tpartner
Replied by tpartner on topic List with comment - hiding text label
That would work but you can also do it with CSS.

1) Assign a CSS class "hidden-textarea-label" to the question.

2) Add this to the end of your theme custom.css file:

Code:
.hidden-textarea-label .text-item label {
  display: none;
}

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The following user(s) said Thank You: krosser
The topic has been locked.
  • krosser
  • krosser's Avatar Topic Author
  • Offline
  • Elite Member
  • Elite Member
More
5 years 7 months ago #172707 by krosser
Replied by krosser on topic List with comment - hiding text label
Nice! Thanks man. So you think hiding it with CSS is better?
I wrote this CSS code but for all such questions.
Code:
.form-group.answer-item.text-item.col-sm-6.col-xs-12 .control-label {
    display: none;
}*

So, your code is more sophisticated. I couldn't figure out this part myself - ".text-item label" :pinch:

I'm using the latest LS 3.22 hosted on LS servers, not installed locally.
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 7 months ago #172709 by tpartner
Replied by tpartner on topic List with comment - hiding text label
It's always better to do it with pure CSS if you can.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The following user(s) said Thank You: krosser
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose