How to hide select options in array with dropdown

More
1 month 3 weeks ago #158970 by mikezhangsky
mikezhangsky created the topic: How to hide select options in array with dropdown
i want remove the option of select in array question type

q1: which one do you like !


sq1: which one do you like first!

sq2: which one do you like second!

sq3: which one do you like third!

sq4: which one do you like last!


answer with dropdown option

a1-1
a2-2
……

a8-8



i want to hide the option a2 in sq2 , a6 in sq4, i try the js like this,but it dose not work :
<script charset="utf-8" type="text/javascript">
	$(document).ready(function() {
           $('#answer876992X273X4721x2 option[value=a2]').remove;
 
         }
</script>
Attachments:

Please Log in to join the conversation.

More
1 month 3 weeks ago #159013 by tpartner
tpartner replied the topic: How to hide select options in array with dropdown
The element IDs get changed when copying the survey so I would use the element indices instead.

<script type="text/javascript" charset="utf-8">		
	$(document).ready(function() {	
 
		// Remove: row 2, column 1, option "a2"
		$('#question{QID} .question-item:eq(1) select:eq(0) option[value="a2"]').remove();	
 
		// Remove: row 4, column 1, option "a6"
		$('#question{QID} .question-item:eq(3) select:eq(0) option[value="a6"]').remove();
	});
</script>

Here is your sample survey with that code.

File Attachment:

File Name: limesurvey...6992.lss
File Size:18 KB

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
1 month 2 weeks ago #159273 by mikezhangsky
mikezhangsky replied the topic: How to hide select options in array with dropdown
thanks . it works .

Please Log in to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now
Join our Newsletter!