Select element has selected value -1.
Select element has selected value 4 (for example), I send form data to the
server. The controller return partial view.
<script>
$(document).ready(function () {
var objSel =
document.getElementById("IDVacationApplicationType");
checkVacationType(objSel);
$("select#IDVacationApplicationType").change(function () {
checkVacationType(this);
});
});
function checkVacationType(elem) {
var item = $(elem).val();
alert(item);
}
</script>
html:
<div class="form-position">
<div class="form-label">
@Html.LabelFor(model => model.VacationApplicationTypes)
</div>
<div class="form-value">
@Html.DropDownListFor(model => model.IDVacationApplicationType,
Model.VacationApplicationTypes)
@Html.ValidationMessageFor(model => model.VacationApplicationTypes)
</div>
</div>
alert shows -1. After that form has select element with selected value =
4. How can I get this 4?
No comments:
Post a Comment