- Posts: 10219
- Thank you received: 3636
Ask the community, share ideas, and connect with other LimeSurvey users!
$('#question174 .answer_cell_003 option[value=6]').text('').hide();
$('#question174 .answer_cell_003 option').each(function(i){ if($(this).val() > 5) { $(this).remove(); } });
<script charset="utf-8" type="text/javascript">
</script>
<script type="text/javascript" charset="utf-8"> $(document).ready(function() { var qID = {QID}; // Define the select element (dropdown) var select1 = '<select class="insertedSelect"> \ <option value="">-- Please Choose --</option> \ <option value="Program 1">Program 1</option> \ <option value="Program 2">Program 2</option> \ <option value="Program 3">Program 3</option> \ <option value="Program 4">Program 4</option> \ </select>'; // Hide the text inputs $('#question'+qID+' .answer_cell_004 input[type="text"]').hide().parent().hide(); // Insert the select elements $('#question'+qID+' .answer_cell_004').append(select1); // Initially select an option if the question has already been answered $('#question'+qID+' .answer_cell_004 input[type="text"]').each(function(i){ if($(this).val()) { $(this).closest('td').find('.insertedSelect').val($(this).val()); } }); // Listener on the dropdowns - insert selected values into hidden text input $('.insertedSelect').change(function() { $(this).closest('td').find('input[type="text"]').val($(this).val()); }); }); </script>