- Posts: 128
- Thank you received: 9
Ask the community, share ideas, and connect with other LimeSurvey users!
Please Log in to join the conversation.
Please Log in to join the conversation.
<script type="text/javascript" data-author="Tony Partner"> $(document).on('ready pjax:scriptcomplete',function(){ // The language codes to keep in the dropdown var relevantLangs = ['en', 'it']; // Identify this question var thisQuestion = $('#question{QID}'); // Only do this if the previous country question == 4 if('{CT}' == '4') { // Loop through the dropdown options $('select.languagesurvey option', thisQuestion).each(function(i) { // Remove unwanted languages if(!relevantLangs.includes($(this).val())) { $(this).remove(); } }); } }); </script>
Please Log in to join the conversation.
Please Log in to join the conversation.
Please Log in to join the conversation.
<script type="text/javascript" data-author="Tony Partner"> $(document).on('ready pjax:scriptcomplete',function(){ // The new language-select labels var langLabels = { 'de-informal': 'Deutsch', 'it-informal': 'Italiano' } // Identify this question var thisQuestion = $('#question{QID}'); // Modify the language-select labels $.each(langLabels, function(key, value) { $('select.languagesurvey option[value="'+key+'"]', thisQuestion).text(value); }); }); </script>
<script type="text/javascript" data-author="Tony Partner"> $(document).on('ready pjax:scriptcomplete',function(){ // The language codes to keep in the dropdown var relevantLangs = ['en', 'it']; // The new language-select labels var langLabels = { 'de-informal': 'Deutsch', 'it-informal': 'Italiano' } // Identify this question var thisQuestion = $('#question{QID}'); // Modify the language-select labels $.each(langLabels, function(key, value) { $('select.languagesurvey option[value="'+key+'"]', thisQuestion).text(value); }); // Only do this if the previous country question == 4 if('{CT}' == '4') { // Loop through the dropdown options $('select.languagesurvey option', thisQuestion).each(function(i) { // Remove unwanted languages if(!relevantLangs.includes($(this).val())) { $(this).remove(); } }); } }); </script>
Please Log in to join the conversation.