0

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>
3
  • your html please ?? Commented Apr 9, 2021 at 7:05
  • @Toxy, this modal is coming from partial view(calling in another view) Commented Apr 9, 2021 at 7:07
  • @Ivan86, user should be able to edit the time [2021/04/09 13:25] to [2021/04/09 w/c] like this. i want textbox shouldn't be readonly Commented Apr 9, 2021 at 7:30

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.