I need to create select2 where I can select multiple values. But I'm getting "no results found" message everytime, tried various solutions but nothing worked. I really don't have idea what's wrong.
<select id="keywords-input" multiple="multiple" style="width:300px">
{*
<option selected="selected" value="Val 1">Val 1</option>*} {*
<option selected="selected" value="Val 2">Val 2</option>*} {*
<option selected="selected" value="Val 3">Val 3</option>*} {*
<option selected="selected" value="Val 4">Val 4</option>*} {*
<option selected="selected" value="asfsafafsa">asfsafafsa</option>*}
</select>
<script>
$(document).ready(function() {
$('#keywords-input').select2({
tags: true,
tokenSeparators: [',', ' '],
data: ['Val1', 'Val2', 'Val3'],
maximumInputLength: 10,
multiple: true
});
});
</script>

It was caused by another javascript that used select2 class, now it works. So it my code wasn't wrong.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With