List with comment - hiding text label

More
1 month 5 days ago #172698 by krosser
krosser created the topic: List with comment - hiding text label
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.
<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.14 hosted on LS servers, not installed locally.
Attachments:

Please Log in or Create an account to join the conversation.

More
1 month 5 days ago #172704 by tpartner
tpartner replied the 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:

.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: LouisGac, krosser

Please Log in or Create an account to join the conversation.

More
1 month 5 days ago #172707 by krosser
krosser replied the 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.
.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.14 hosted on LS servers, not installed locally.

Please Log in or Create an account to join the conversation.

More
1 month 5 days ago #172709 by tpartner
tpartner replied the 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

Please Log in or Create an account to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now
Join our Newsletter!