- Posts: 38
- Thank you received: 0
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
How to hide select options in array with dropdown
- mikezhangsky
- Topic Author
- Offline
- Junior Member
Less
More
6 years 7 months ago #158970
by mikezhangsky
How to hide select options in array with dropdown was created by mikezhangsky
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 :
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 :
Code:
<script charset="utf-8" type="text/javascript"> $(document).ready(function() { $('#answer876992X273X4721x2 option[value=a2]').remove; } </script>
Attachments:
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10109
- Thank you received: 3593
6 years 6 months ago #159013
by tpartner
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Replied by tpartner on 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.
Here is your sample survey with that code.
Code:
<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.
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Attachments:
The topic has been locked.
- mikezhangsky
- Topic Author
- Offline
- Junior Member
Less
More
- Posts: 38
- Thank you received: 0
6 years 6 months ago #159273
by mikezhangsky
Replied by mikezhangsky on topic How to hide select options in array with dropdown
thanks . it works .
The topic has been locked.