Question

i have issue in MVC project.

I already tested in create.cshtml by add this code :

<link rel="stylesheet" href="//code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css">
<script src="//code.jquery.com/jquery-1.9.1.js"></script>
<script src="//code.jquery.com/ui/1.10.4/jquery-ui.js"></script>

<script>
$(function() {
$( "#datepicker" ).datepicker();
});

and for the textbox input :

<input type="text" id="datepicker">

and it worked, when i click or keypress on textbox, datepicker popup is show up.

but when i want this javascript and css file run locally in my pc by put in _layout.cshtml (behave as general in all page) :

@Scripts.Render("~/Scripts/jquery-1.9.1.js")
@Scripts.Render("~/Scripts/jquery-ui.js")
@Styles.Render("~/Content/themes/base/jquery-ui.css")
@RenderSection("scripts", required: false)

and remark the direct link to jquery online (source) in my create.cshtml , after that i run that page doesn't show up the datepicker, is i missing something for this issue ?

ps: i already save the jquery-1.9.1.js , jquery-ui.js , jquery-ui.css in my local pc

Was it helpful?

Solution

Because your path of file missing on local.

<link rel="stylesheet" href="//code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css">
<script src="//code.jquery.com/jquery-1.9.1.js"></script>
<script src="//code.jquery.com/ui/1.10.4/jquery-ui.js"></script>

Change to

<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css">
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="http://code.jquery.com/ui/1.10.4/jquery-ui.js"></script>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top