Hi @Peter_1985 ,
and it did assign today value to that field. How to avoid changing value of the relevant Textbox field?
According to your code, you are using Bootstrap Datepicker, right?
To assign today value and make the textbox read-only, you could set the date range and add the readonly
property for the textbox.
Refer to the following sample: Set the datepicker's startDate
and endDate
property, limit the datepicker to select today.
<input type="input" class="form-control" id="inputDate" readonly="readonly">
$('#inputDate').datepicker({
autoclose: true,
todayHighlight: false,
startDate: new Date(),
endDate:new Date(),
}).datepicker("setDate",'now');
The result is like this (you can also view the result from this link):
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.
Best regards,
Dillion