$(document).ready(function() {
// Get the initial value
var $el = $('#ddlCategoryName');
$el.data('previousCategoryID', $el.val());
$el.change(function() {
//store new value
var $this = $(this);
var newValue = $this.data('newVal', $this.val());
})
.focus(function() {
// Get the value when input gains focus
var previousCategoryID = $(this).data('previousCategoryID');
});
});
Hi all, my requirement is to always keep track of the previous value when a new option is selected in a dropdownlist. The sample code above works only on the first page load but never on subsequent dropdownlist selection changes.
Does any one know the modification i need to do to make the code track the value of the previous selection a very time a new selection is made in the "ddlCategoryName" dropdownlist.
I want to always know what the previous value after making a new selection.