Welcome to the LimeSurvey Community Forum

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

List with comment - hiding text label

More
7 years 3 weeks ago #172698 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.22 KB


Cheers :)

I'm using the latest LS 3.22 hosted on LS servers, not installed locally.
More
7 years 3 weeks ago #172704 by tpartner
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.
More
7 years 3 weeks ago #172707 by krosser
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.
More
7 years 3 weeks ago #172709 by tpartner
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.
Moderators: tpartnerholch

Lime-years ahead

Online-surveys for every purse and purpose