I have this dropdown , I want to warn / write something when the value in it is changed. What happens when I click the dropdown button with the mouse and select any other value, a change event occurs. But when the focus is in dropdown , and I click the up and down arrow, it changes the value in the drop-down list, but the event does not fire, and now a warning appears. Here is the code
<select id="drpDay" name="drpDay" style="background-color: white;"> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> <option value="6">6</option> <option value="7" selected="selected">7</option> </select> </br> <select id="drpMonth" name="drpMonth" style="background-color: white;"> <option value="Jan">Jan</option> <option value="Feb">Feb</option> <option value="Mar">Mar</option> <option value="Apr">Apr</option> <option value="May">May</option> <option value="Jun">Jun</option> <option value="Jul">Jul</option> <option value="Aug">Aug</option> <option value="Sep">Sep</option> <option value="Oct">Oct</option> <option value="Nov" selected="selected">Nov</option> <option value="Dec">Dec</option> </select> </br> <label id="lbl" text="" width="auto">adsf</label>
js
$('#drpDay, #drpMonth').change(function(event) { alert(event.which); $('#lbl').text('change ' + event.which + ' and ' + $(event.target).attr('id')); });
Here's the script http://jsfiddle.net/2NBPx/4/
I want that when changing the value in the event selection field, pressing the up and / or down arrow, I want this event to be fired. Why don't they shoot, and how do I get it to change from the keyboard?
source share