@{IDictionary<string, object> datepickerHtmlAttribute = new Dictionary<string, object>();
//Binding the onchange event to the input element of the DatePicker using its HtmlAttributes property
datepickerHtmlAttribute.Add("onchange", "inputValueChange()");
}
<div id="ControlRegion">
<div class="frame ">
<div class="control">
@*Binding the onchange event to the input element of the DatePicker using its HtmlAttributes property*@
@Html.EJ().DatePicker("dateId").HtmlAttributes(datepickerHtmlAttribute)
</div>
</div>
<style>
.frame .control {
margin-left: 100px;
}
</style>
<script>
function inputValueChange() {
//By binding the native onchange event to the input element of the DatePicker,
//we can get the value entered in the input element
var value = document.getElementById("dateId").value;
console.log("Value in the input element: " + value);
}
</script>
</div> |