HTML:
<select multiple="" name="selectinputmultiple" id="">
<option value="1">One</option>
<option value="2">Two</option>
<option value="3">Three</option>
</select>
jQuery:
$('select[name=selectinputmultiple]').on('change', function() {
console.log(this.value);
});
Console just shows the first selected value, I want to save values in an array on each change. So for example:
- If a user selected
1
and2
=> {1,2} - Then the user unselected
1
and selected3
=> {2,3}