Selecting values from multiple select option box - Jquery
parseInt()
will only parse the first integer from 4,5
. If you want to get all the intgers as an array, split the string and call parseInt()
on each array element.
items = selected.split(',').map(str => parseInt(str));
$("#edit-items").val(items);