- Posts: 6
- Thank you received: 0
Ask the community, share ideas, and connect with other LimeSurvey users!
<script type="text/javascript" charset="utf-8"> $(document).on('ready pjax:scriptcomplete',function(){ var thisQuestion = $('#question{QID}'); // Column specific classes $('tr.subquestion-list', thisQuestion).each(function(i) { $('th, td', this).each(function(i) { $(this).addClass('column-'+i); }); }); // Insert selects into column 1 if($('.answer-item.column-1 .inserted-select', thisQuestion).length == 0) { $('.answer-item.column-1', thisQuestion).addClass('with-select').append('<select class="inserted-select form-control list-question-select">\ <option value="">Please choose...</option>\ <option value="1">Yes</option>\ <option value="2">No</option>\ <option value="3">Do not know</option>\ </select>'); } // Insert selects into column 2 if($('.answer-item.column-2 .inserted-select', thisQuestion).length == 0) { $('.answer-item.column-2', thisQuestion).addClass('with-select').append('<select class="inserted-select form-control list-question-select">\ <option value="">Please choose...</option>\ <option value="1">Red</option>\ <option value="2">Blue</option>\ <option value="3">Pink</option>\ <option value="3">Purple</option>\ </select>'); } // Listeners on select elements $('.inserted-select', thisQuestion).on('change', function(i) { if($(this).val() != '') { $(this).closest('.answer-item').find('input:text').val($.trim($('option:selected', this).text())).trigger('change'); } else { $(this).closest('.answer-item').find('input:text').val('').trigger('change'); } }); // Returning to page $('.with-select input:text', thisQuestion).each(function(i) { var thisCell = $(this).closest('.answer-item'); var inputText = $.trim($(this).val()); var selectval = $('select.inserted-select option', thisCell).filter(function () { return $(this).html() == inputText; }).val(); $('select.inserted-select', thisCell).val(selectval); }); // Clean-up styles $('select.inserted-select', thisQuestion).css({ 'max-width': '100%' }); $('.with-select input:text', thisQuestion).css({ 'position': 'absolute', 'left': '-9999em' }); }); </script>
(that.Q1.sq_Y001_X001 == 'Yes' OR (that.Q1.sq_Y001_X001 == 'No' AND count(that.Q1.sq_Y001) == 4)) AND (that.Q1.sq_Y002_X001 == 'Yes' OR (that.Q1.sq_Y002_X001 == 'No' AND count(that.Q1.sq_Y002) == 4)) AND (that.Q1.sq_Y003_X001 == 'Yes' OR (that.Q1.sq_Y003_X001 == 'No' AND count(that.Q1.sq_Y003) == 4)) AND (that.Q1.sq_Y004_X001 == 'Yes' OR (that.Q1.sq_Y004_X001 == 'No' AND count(that.Q1.sq_Y004) == 4))
<a href="#" data-toggle="tooltip" title="" data-original-title="Tooltip content 1">this has a tooltip</a>