Mahendra
Mahendra

Reputation: 337

JQuery DateTimepicker allow user text input

How do I use a jQuery Datetimepicker with a user textbox input?

       $(document).on('click', '#txtUserDateTime', function (evt) {
            $('#txtUserDateTime').datetimepicker({
                format: 'm/d/Y H:i',
                step: 5,
                minDate: 0
            });              
        });

txtUserDateTime - CalendarImage

In the above image I can set Date and Time and the textbox is readonly. Sometimes I wanted to change only the time as some text like for example: "w/c" etc. but the datetimepicker textbox is not allowing me to hold the value after click outside of the event.

The Datetimepicker("#txtUserDateTime") textbox doesn't allow the user input. Can we achieve this?

And below is my cshtml code:

<div class="col-sm-3">
            <div class="input-group date">
                <span class="csts-date-time-picker" style="width: 100%;">
                    <input asp-for="NeedDate" type="text" id="txtCraneDateTime" class="form-control" tabindex="0">
                </span>
                <span asp-validation-for="NeedDate" class="text-danger"></span>
            </div>
        </div>

Upvotes: 0

Views: 519

Answers (0)

Related Questions