2

I am trying to localize datepicker and I can't fully understand where each code block should be.

In a view I have a script:

<script src="~/Scripts/jquery-1.10.2.js"></script>
<script src="~/Scripts/jquery-ui.js"></script>
<script type="text/javascript" src="https://raw.githubusercontent.com/jquery/jquery-ui/master/ui/i18n/datepicker-lv.js"></script>
<link href="~/Content/themes/custom/jquery-ui.css" rel="stylesheet" />

<script>
  $(function() {
    $('#datepicker').datepicker(
      $.datepicker.regional["lv"]
    );
  });
</script>

It has to be working with this text box in a same view:

<tr>
  <td align="left">@Html.LabelFor(m => m.TestDate)</td>
  <td align="left">@Html.TextBoxFor(m => m.TestDate, new { id = "datepicker", style = "width:200px"})</td>
</tr>

What is missing in that code?

3
  • Possible duplicate of How do I localize the jQuery UI Datepicker? Commented Jun 2, 2016 at 12:43
  • I still cant get the point what is missing in my code, i saw that post and tried to do the same. Commented Jun 3, 2016 at 10:35
  • Are you have any errors in the web browser console? Commented Jun 3, 2016 at 12:34

1 Answer 1

2

I think "datepicker-lv.js" might not load and you are not aware of this. With the default settings on an ASP .NET MVC project you will get the following error :

You should try do download the datepicker-lv.js, include in your project as the others scripts file and load it from there.

Sign up to request clarification or add additional context in comments.

Comments

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.