Select2 newline seperator
Select2 tags with newline as token separator
HTML
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/select2/3.5.1/select2.min.css">
<script src="//cdnjs.cloudflare.com/ajax/libs/select2/3.5.1/select2.min.js"></script>
<link rel="stylesheet" href="http://select2.github.io/select2/bootstrap/css/bootstrap.css">
<input id="search_tags" type="hidden" style="width:100%;" tabindex="-1">
JavaScript
$('#search_tags').select2({
tags: [],
tokenSeparators: [""],
dropdownCssClass: 'select2-hidden',
placeholder: "Paste Here",
formatNoMatches: function() {return '';}
});
$('.select2-input').on('paste', function(e) {
//get the raw pasted text
var data = e.originalEvent.clipboardData.getData('Text');
//replace newlines by tabs and add to conent
$(this).val($(this).val() + '\t' + data.replace(/\n/g, '\t') + '\t');
//prevent normal paste behaviour
return false;
});