function LoadData(id) {
var employeeId = $.trim($("#employeeId").val());
var employeeType = $.trim($("#employeeType").val());
var obj = "";
var CityId = $.trim($("#ddlCity").val());
obj = new ViewModel1(employeeId, employeeType, 0, $.trim($("#DeptName").val()), "", "", $.trim($("#SectionName").val()), CityId);
var postedData = JSON.stringify(obj);
Loader();
$.ajax({
//...........
//...........
})
}
I have the above function and i want to get the previously selected value in the element #ddlCity. The above function is called from the line below.
@Html.DropDownGroupListFor(m => m.CityId, Model.GroupedTypeOptions, new { name = "ddlCity", id = "ddlCityName", @onchange = "javascript:LoadData(this.value)" })
var CityId = $.trim($("#ddlCity").val()); is giving me the CityId of my new selection in the dropdownlist.
So how can i get the CityId of the previously selected value?