Hi Stefano,
Thanks for contacting Syncfusion Support.
Yes we can restrict entering value in the DatePicker input element by adding readonly attribute to the input element of the component by using the created event as shown in the below code snippet.
|
<ejs-datepicker id="datepicker" created="onCreate"></ejs-datepicker>
<script>
function onCreate(args){
var proxy = this;
this.element.setAttribute("readonly", true);
this.inputWrapper.container.addEventListener("click", function (args) {
var obj = document.getElementById("datepicker").ej2_instances[0];
obj.show()
});
}
</script> |
Once readonly attribute is enabled, the input element becomes unable to edit and you can select a value only by opening the popup element. For your convenience, we have also attached the sample in the below link. Please check it.
Regards,
Prem Kumar M