Hide next question by answering previous one

More
4 years 4 weeks ago #138964 by Stan
Hi, i would like to simply hide a question Q2 when the direct previous question Q1 (multiple choice) is answered through Checkbox (click).
I tried some EM and Javascript without success and may Need some help.
Using Version 2.50+ Build160606

This is what i've tried
 <script type="text/javascript" charset="utf-8">	
	$(document).ready(function() {
      // Identify the questions
		var this = $('#Q1{ID}');
		var nextQuestion = $(thisQuestion).next('div[id^="question"]');
     if ($(this).is(':checked')) {
        $(this).(nextQuestion).hide();
    }
    else{
        $(this).(nextQuestion).show();
    }
});
 
</script>
The topic has been locked.
LimeSurvey Partners
More
4 years 4 weeks ago #138965 by tpartner
You should be able to use Expression manager relevance like this:

Q1_SQ001 != 'Y'

Sample survey attached:

File Attachment:

File Name: limesurvey...22-2.lss
File Size:21 KB

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Official LimeSurvey Partner - partnersurveys.com
Attachments:
The following user(s) said Thank You: Stan
The topic has been locked.
More
4 years 4 weeks ago #138966 by Stan
Thank you!
The topic has been locked.
More
4 years 3 weeks ago #138983 by DenisChenu
Hi,

Just one question:
// Identify the questions
		var this = $('#Q1{ID}');
Where do you find this ?
#question{Q1.qid} or #answer{Q1.sgq} why not, but where did you found #Q1{ID} ????

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development . I don't answer to private message.
The topic has been locked.
More
4 years 3 weeks ago #138989 by tpartner
I didn't address any JavaScript issues because it's not required.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Official LimeSurvey Partner - partnersurveys.com
The topic has been locked.
More
4 years 3 weeks ago #138990 by DenisChenu
Yes, and your solution is really better :).
But i want to know where Stan found this instructions :). Maybe some error in manual :)

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development . I don't answer to private message.
The topic has been locked.
More
4 years 3 weeks ago #139276 by Stan

DenisChenu wrote: But i want to know where Stan found this instructions :). Maybe some error in manual :)

Hi, this has nothing to do with the Manual. i just tried to fix the issue by writing my own Javascript code. Then i posted it here, so that someone could eventually show me what is wrong with that code (so thanks for your corrections), or propose a better way like tpartner did.
The topic has been locked.

Start now!

Just create your account and start using Limesurvey today.

Register now