I have a form with two selection fields for which I use select2 to match and tokenize what has ever been inserted into the field. I need to convert a list of inputs, separated by a new line, to a list, separated by a space (because IE does not do this automatically).
I have the following code that works fine with any fields <input>:
$('#editor').bind('paste', function (e) {
var clipped = window.clipboardData.getData('Text');
clipped = clipped.replace(/(\r\n|\n|\r)/gm, " ");
$(this).val(clipped);
alert(clipped);
return false;
});
but it does not work if #editor is a field <select>.
<form method="POST" action="/run" class="ui-widget" onsubmit=" return confirmSubmit(this, 'run',true) ">
Editor:
<select name="editor" id="editor" multiple style="width: 200px">
<option>ALL</option>
</select>
<input type="submit" value="Submit">
</form>
any idea what is missing?
source
share