I want to make a datepicker in my View. So I changed TextBox to this :

<div class="form-group">
    @Html.LabelFor(model => model.ProjectDeadline, new { @class = "control-label col-md-2" })
    <div class="col-md-10">
        @Html.TextBoxFor(model => model.ProjectDeadline, new { @class = "form-control datepicker", placeholder = "Enter date here..." })
        @Html.ValidationMessageFor(model => model.ProjectDeadline)
    </div>
</div>

I also added this jQuery code to _Layout.cshtml :

@Scripts.Render("~/bundles/jquery")
@Scripts.Render("~/bundles/bootstrap")
<script type="text/javascript">
    $(function () {
        $('.datepicker').datepicker(); 
    });
</script>
@RenderSection("scripts", required: false)

But it isn't working, I can't see any datepicker. Can you tell me what I did wrong? Did I place jQuery code somewhere wrong? Thanks.

Related posts

Recent Viewed