[Answered ]-Jquery datepicker not display on my django project

0πŸ‘

βœ…

β€œjQuery is not defined” means jQuery.js is not loaded.

From looking at your code, it is probably one of the following two reasons:

  1. The incorrect HTML markup. Try to take away the <head> tag around <script> and <link>.
  2. The jQuery file included has incorrect path or the file itself is corrupted. Try to replace /media/js/jquery-1.6.2.min.js with http://code.jquery.com/jquery-1.6.4.min.js and see if this fixes the problem. If it does, there is something wrong with your jQuery file.
πŸ‘€William Niu

1πŸ‘

Mistake is on jquery function. Your date fields class is β€˜input’, then jquery should be something like:

$(function() {
    $(".input").datepicker({ dateFormat: 'dd/mm/yy' });
πŸ‘€dani herrera

1πŸ‘

If anyone else is following this trail, I had this same issue and resolved it. Like the original poster, I was loading the JS in the <head><script> section. It worked when I moved it out of that section and placed it at the bottom of the HTML

<script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js"></script>
<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/themes/flick/jquery-ui.css" />

<script>
    $(function() {
    $( ".datePicker" ).datepicker();  # change ".datePicker" to match your code
    });
</script>

πŸ‘€eezis

Leave a comment