- Posts: 103
- Thank you received: 5
Ask the community, share ideas, and connect with other LimeSurvey users!
</script src="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.5/js/select2.full.js"></script> <script type="text/javascript" charset="utf-8"> $(document).ready(function(){ var qID = {QID}; /* identify question */ var wordList1=[ { id: 1, text: 'Option 1' }, { id: 2, text: 'Option 2' }, { id: 3, text: 'Option 3' }, { id: 4, text: 'Option 4' } ]; $('#question'+qID+' input[type="text"][id$="_1"]').select2({ data: wordList1, width: '95%', placeholder: '...', tags: true, multiple: true, tokenSeparators: [',', ' '] } ); } ); </script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.5/js/select2.full.js"></script> <script type="text/javascript" charset="utf-8"> $(document).ready(function(){ var qID = {QID}; /* identify question */ var wordList1=[ { id: 1, text: 'Option 1' }, { id: 2, text: 'Option 2' }, { id: 3, text: 'Option 3' }, { id: 4, text: 'Option 4' } ]; $('#question'+qID+' input[type="text"][id$="_1"]').select2({ data: wordList1, width: '95%', placeholder: '...', tags: true, multiple: true, tokenSeparators: [',', ' '] } ); } ); </script>
<p>Example 3v3: Question?</p> <script src="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.5/js/select2.full.js"></script> <script src="https://rawgit.com/lingceng/d1cd5ca5db9a777b31487769242c422f/raw/69e98eeb1a154d625bb85e3420b7738f5f56961c/select2_input_tags.js"></script> <script type="text/javascript" charset="utf-8"> $(document).ready(function(){ var qID = {QID}; /* identify question */ var wordList1=[ { id: 1, text: 'Option 1' }, { id: 2, text: 'Option 2' }, { id: 3, text: 'Option 3' }, { id: 4, text: 'Option 4' } ]; select2InputTags($('#question'+qID+' input[type="text"][id$="_1"]')).select2({ data: wordList1, width: '95%', minimumResultsForSearch: -1, tags: true, placeholder: "...", multiple: true }); }); </script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.5/js/select2.full.js"></script> <script src="https://rawgit.com/lingceng/d1cd5ca5db9a777b31487769242c422f/raw/69e98eeb1a154d625bb85e3420b7738f5f56961c/select2_input_tags.js"></script> <script type="text/javascript" charset="utf-8"> $(document).ready(function(){ var qID = {QID}; /* identify question */ var wordList1=[ { id: 1, text: 'Option 1' }, { id: 2, text: 'Option 2' }, { id: 3, text: 'Option 3' }, { id: 4, text: 'Option 4' } ]; $('#question'+qID+' input[type="text"][id$="_1"]').each(function(i) { select2InputTags($(this)).select2({ data: wordList1, width: '95%', minimumResultsForSearch: -1, tags: true, placeholder: "...", multiple: true }); }); }); </script>