I have a multiselect dropdown and when the users selects either individual items or by pressing ctrl or shift I would like to capture the items and store them in an array, which afterwards take each value in the array and do some other things with it. I have accomplished the first part which is this:
var selectValues = new Array();
$('#ddlBProduct').change(function () {
selectValues = [];
selectValues.push($(this).val());
MyFunction();
});
function MyFunction(){
$.each(selectValues, function () {
var theitem = $('#' + this).html();
});
}
no in that function MyFunction for some reason i keep getting all the values as 1 value instead of each individual on. What I am assuming is that the "individual" value in the array is actually a list of all of the selected option instead of separating them into the array. help?
EDIT: removing the
selectValues = [];
results in this:
["81"]
["81"]
["81", "102"]
["81"]
["81", "102"]
["81", "102", "30"]
and thats when selecting one option and pressing shift and selecting more items.