I have two DropDowns
, on change
event of one Drop Down, i haved filled the 2nd Drop Down.
when i trigger the change event of first drop down on Arrow Keys
, its not working, while on Mouse click
its working fine.
Here is my Code..
$('#cmbCategory').on('change', function () {
//alert($(this).val());
// the below function will get Sub Categories from DataBase.
getSubCategories($('#cmbCategory :selected').val(), '');
}).keydown(function (e) {
if (e.which == 37 || e.keyCode == 38 || e.keyCode == 39 || e.keyCode == 40) {
$(this).trigger('change');
}
});
This code works fine while using Mouse
, but doesn't work on Arrow Keys
.
Any Help..
I think you have to add
keyup
event or you can also usekeypress
eventNote: Above code is not tested