Inhibit sub-question of multi choice based on other sub questions checked

More
4 years 2 months ago #91653 by ctdh
Hi
I have a 'simple' issue ;) I am struggling with...
A multi choice question:
Q1_SQ1 Choice A
Q2_SQ1 Choice B
Q3_SQ1 Choice C

I would like to be able to disable choice C if either A or B are selected

Can I do this in LS 2.00?

Thanks
Charles

Please Log in to join the conversation.

More
4 years 2 months ago #91662 by ctdh
ok I have got this far
$(document).ready(function() {
 
		$('#answer537386X22X3129SQ3').change(function() {
			if ( $('#answer537386X22X3129SQ3').val() == 'Y' ) {
 				$('input[name="537386X22X3129SQ1"]').attr('disabled', 'disabled');
			}
		});
	});

The problem is that the if statement is always being triggered even when I uncheck #answer537386X22X3129SQ3

Any ideas what I need to do??

Thanks.

Please Log in to join the conversation.

More
4 years 2 months ago #91668 by tpartner
It seems to me that your code is trying to disable choice "A", not choice "C".

If you want to disable "C" when "A" or "B" are selected:
	$(document).ready(function() {
 
		$('#answer537386X22X3129SQ1, #answer537386X22X3129SQ2').change(function() {
			if ( $(this).attr('checked') == true) {
				$('input[name="537386X22X3129SQ3"]').attr('disabled', 'disabled');
			}
			else {
				$('input[name="537386X22X3129SQ3"]').attr('disabled', '');
			}
		});
	});

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.