My issue is that the change event will trigger whenever there is a change made in select element which also includes the page load when select element is populated with items and I don't want this.
I only want the change event (or some more proper event) to trigger ONLY when a selection is changed by the user via the mouse or keyboard.
In WPF this is resolved by having change and selectionchange events which correspond to the second scenario that I want.
<select id="filter_notification_byproductname" name="filter_notification_byproductname" asp-for="@Model.FilterByProductName" class="notification_list_list_filter_controll_input" asp-items="@Model.ProductDictionaryOfSelectListItemsForFiltering.Keys" multiple></select>
@section Scripts {
<script type="text/javascript">
$("#filter_notification_byproductname").bind("change", {
productChanged: true
}, SendIndexes);
function SendIndexes(productChanged) {
// SEND DATA TO THE SERVER
}
}
</script>
}