khushbu February 2016

datepicker is not working in mvc4

I beginner in mvc Going to create application.I want to display datepicker in my application on textbox.I have written code in view .cshtml

<link href="~/Content/themes/base/minified/jquery.ui.datepicker.min.css" rel="stylesheet" />
<script src="//code.jquery.com/jquery-1.10.2.js"></script>
<script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"/>
<link rel="stylesheet" href="/resources/demos/style.css">

<script>

    $(document).ready(function () {
        $("#date").datepicker();
     });
</script>
<h2>Index</h2>
<input type="text" id="date" />

When I click on textbox it is not working Please help if anyone have any idea about this.

Answers


Ognjen Babic February 2016

Include jQuery UI in your script, add class="datepicker" where you want your datepicker to apear, and add this function:

$(function() {
    $( ".datepicker" ).datepicker();

});

Post Status

Asked in February 2016
Viewed 1,380 times
Voted 12
Answered 1 times

Search




Leave an answer