- Thank you received: 0
Ask the community, share ideas, and connect with other LimeSurvey users!
<script type="text/javascript" charset="utf-8"> $(document).ready(function() { var qID = 9334; var inputNum = 1; // Define the select element (dropdown) var select1 = '<select id="select1"> \ <option value="">-- Please Choose --</option> \ <option value="Mrs.">Mrs.</option> \ <option value="Mr.">Mr.</option> \ <option value="Doctor">Doctor</option> \ <option value="Miss">Miss</option> \ <option value="Other">Other</option> \ </select>'; // Hide the text input $('#question'+qID+' li:eq('+(inputNum-1)+') input.text').hide().parent().hide(); // Insert the select elements $('#question'+qID+' li:eq('+(inputNum-1)+')').append(select1); // Initially select an option if the question has already been answered if($('#question'+qID+' li:eq('+(inputNum-1)+') input.text').val()) { $('#question'+qID+' li:eq('+(inputNum-1)+') select').val($('#question'+qID+' li:eq('+(inputNum-1)+') input.text').val()); } // Listener on the dropdowns - insert selected values into hidden text input $('#question'+qID+' select').change(function() { $(this).siblings('span').children('input.text').val($(this).val()); }); // Some styles $('#question'+qID+' select').css({ 'margin':'0.3em 0 0 1em' }); }); </script>
Yes....are you talking about this line?
Not when you have a variable (string) which spans several lines. In that case, every line must end with a backslash character '\'. You could put the whole string on one line but it would be kinda hard to read.I thought java scripts were immune to that?