1
 <!doctype html>
 <html lang="en">
 <head>
    <meta charset="utf-8">
    <title>jQuery UI Datepicker - Default functionality</title>
    <link rel="stylesheet" href="jquery-ui.css">

    <script src="jquery.js" type="text/javascript"></script>
    <script src="jquery-ui.js" type="text/javascript"></script>
    <!--<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/jquery-ui.js" type="text/javascript"></script>-->

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

</head>
<body>
    <p>Date: <input type="text" id="datepicker"></p>
</body>
</html>

My date picker works if I comment out the ajax.google line. I thought the date picker is part of the jquery UI. what am I doing wrong or missing?

Huangism
  • 16,278
  • 7
  • 48
  • 74
Arcadian
  • 4,312
  • 12
  • 64
  • 107
  • I don't understand... You seem to be saying its working with the ajax line commented out... So what's the problem? – ControlAltDel Sep 04 '14 at 17:55
  • I need the ajax.google for my file upload plugin. if I uncomment that line the file upload works but the datepicker would break. – Arcadian Sep 04 '14 at 18:14

1 Answers1

0

I obviously can't tell what's in your local jQuery files, but Google's copy of 1.8.18 works just fine:

<link rel="stylesheet" href="//ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/themes/smoothness/jquery-ui.css" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/jquery-ui.min.js"></script>
<div class="demo">
    <input type="text" id="datepicker">
</div>

http://jsfiddle.net/eqd4x1rq/2/

aolsen
  • 36
  • 5
  • I am using jquery 1.10.2 and it is not working with that. but for the file upload it requires 1.8.18 so I am mixing and matching. – Arcadian Sep 04 '14 at 19:06
  • You can't load two different versions of jquery-ui's (if I'm understanding you correctly). And it shouldn't matter if you're using 1.10.2 or 1.8.18 with regards to the datepicker. It's supported in both versions. – aolsen Sep 04 '14 at 19:14
  • no I am not using two UIs. I am using jquery 1.10.2 as in line two of your sample. – Arcadian Sep 04 '14 at 19:16
  • if you go to jfiddle and change 1.4.2 to 1.10.2 it will not work. – Arcadian Sep 04 '14 at 19:17
  • Which file upload plugin are you using? That seems to be the constraint here, as datepicker works fine if you use newer versions of jquery-ui (like 1.10.2 for instance). – aolsen Sep 04 '14 at 19:36
  • Anyway, the cause of it not working for you, is most definitely the jquery/jquery-ui mismatch. You can read more here: http://stackoverflow.com/questions/9638247/is-jquery-browser-deprecated – aolsen Sep 04 '14 at 19:40
  • i don't see that using newer versions of jquery-ui causes issues with that file upload plugin. Isn't the answer to your problems to just use latest versions of jquery and jquery-ui? – aolsen Sep 04 '14 at 20:55