Show hidden question when button is pressed

More
3 years 10 months ago #103266 by baszek
baszek created the topic: Show hidden question when button is pressed
Is it possible to show/reavel previously hidden question with button press.
I know that I can make button with java script and found the way to hide question -> with option in advanced tab ->"always hide this question" set to yes.
I dont know how to show/reveal now that question in button action with javascript.

Please Log in to join the conversation.

More
3 years 10 months ago #103282 by tpartner
tpartner replied the topic: Show hidden question when button is pressed
You cannot hide the question with the advanced setting - this prevents the question from being rendered in the document so it can never be shown. You will need to initially hide the question with CSS or JavaScript.

.

Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

Please Log in to join the conversation.

More
3 years 10 months ago - 3 years 10 months ago #103284 by baszek
baszek replied the topic: Show hidden question when button is pressed

tpartner wrote: You cannot hide the question with the advanced setting - this prevents the question from being rendered in the document so it can never be shown. You will need to initially hide the question with CSS or JavaScript.
.

I was trying with that code, which I found at this forum:
$('#questionQQ').hide();
where QQ is my question id, but it does not work.
Last Edit: 3 years 10 months ago by baszek.

Please Log in to join the conversation.

More
3 years 10 months ago #103288 by tpartner
tpartner replied the topic: Show hidden question when button is pressed
This will work if you use the correct ID:


If your script is placed in the source of the hidden question, you can use the {QID} placeholder:
<script type="text/javascript" charset="utf-8">	
	$(document).ready(function() {
		$('#question{QID}').hide();
	});
</script>

Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Attachments:

Please Log in to join the conversation.

More
3 years 10 months ago #103289 by baszek
baszek replied the topic: Show hidden question when button is pressed
Thx - its working, but is it possible now to reveal/show that hidden question from code of other question (which is in the same group)?

Please Log in to join the conversation.

More
3 years 10 months ago #103291 by tpartner
tpartner replied the topic: Show hidden question when button is pressed
Sure but the code would vary a little depending on question types and positions. Can you attach a small survey with that group and indicate where you want the button and which question is to be hidden?

Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

Please Log in to join the conversation.

More
3 years 10 months ago #103292 by tpartner
tpartner replied the topic: Show hidden question when button is pressed
Oh, and what version of LS are you using?

Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

Please Log in to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now
Join our Newsletter!