Datepicker is not showing when I click on the textbox.
My view code is as follow .
<html>
<head>
<meta name="viewport" content="width=device-width" />
<script src="~/Scripts/jquery-ui-1.12.1.min.js"></script>
<link href="~/Content/bootstrap.min.css" rel="stylesheet" />
<title>Plane_Schedule</title>
</head>
<section class="registersection">
<div class="container-fluid">
<div class="row">
<div class="signupForm">
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
@using (Html.BeginForm("SaveSchedule", "Users", FormMethod.Post))
{
@Html.AntiForgeryToken()
@Html.ValidationSummary(true)
<div class="Form1">
<div class="row">
<div class="Form1">
<div class="form-group col-sm-4">
<div class="editor-field">
<label>
FROM
@Html.EditorFor(model => model.Plane_LocFrom)
</label>
@Html.ValidationMessageFor(model => model.Plane_LocFrom)
</div>
</div>
<div class="form-group col-sm-4">
<div class="editor-field">
<label>
TO
@Html.EditorFor(model => model.Plane_LocTo)
</label>
@Html.ValidationMessageFor(model => model.Plane_LocTo)
</div>
</div>
</div>
<div class="Form2">
<div class="form-group col-sm-4">
<div class="editor-field">
<label>
Departure Time
@Html.EditorFor(model => model.Time_Dep, new { @class = "datepicker" })
</label>
@Html.ValidationMessageFor(model => model.Time_Dep)
</div>
</div>
<div class="form-group col-sm-4">
<div class="editor-field">
<label>
Arrival Time
@Html.EditorFor(model => model.Time_Arrive, new { @class = "datepicker" })
</label>
@Html.ValidationMessageFor(model => model.Time_Arrive)
</div>
</div>
</div>
</div>
</div>
<p>
<input type="submit" value="Register" />
</p>
}
</div>
</div>
</div>
</div>
</section>
@section scripts{
<script src="~/Scripts/jquery-ui-1.12.1.min.js"></script>
<script src="~/Scripts/jquery-ui-1.12.1.js"></script>
}
<script>
$(function () {
$(".datepicker").datepicker({
dateformat: "yy/mm/dd",
changemonth=true,
changeyear=true,
minDate: new Date(2018, 0, 1),
maxDate: new Date(2019, 0, 1),
showOn="both",
buttonText:"Select"
});
});
</script>
I want to show the datepicker on Time_Arrive and Time_Dep textboxes when user enter it. I have added the JQuery ui script as well. My JQuery function is written above. I want the user to enter the date between 2018 and 2019.