1

So, I am using a very simple Datepicker. It works fine in Firefox and Chrome. But not at all in IE. I am relatively new to jQuery and cannot figure this out. Here is my code. I stripped it down so that this page has nothing but the datepicker on it, but still doesn't work.

<!DOCTYPE html>
<html>
<head>
<title>Testing</title>
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<link rel="stylesheet" href="//ajax.googleapis.com/ajax/libs/jqueryui/1.11.2/themes/smoothness/jquery-ui.css" />
<script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.11.2/jquery-ui.min.js"></script>
<script>
$(document).ready(function() {
  $('#txtDate').datepicker({
    showAnim: 'slide',
    dateFormat: 'mm-dd-yy',
  });
});
</script>
<style>
body
{
    font-family:Arial;
    font-size : 10pt;
    padding:5px;
}
</style>
</head>
<body>
<input type='text' id='txtDate'>
</body>
</html>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
Dylan Corriveau
  • 2,561
  • 4
  • 29
  • 36
trouble706
  • 48
  • 3
  • 15
  • 2
    Can you define "doesn't work"? Also, what versions of IE? – Randy Minder Nov 03 '14 at 14:45
  • IE 11. And it does nothing... If I click in the text box which should bring up the calendar, nothing happens other than the cursor starts blinking.. – trouble706 Nov 03 '14 at 14:50
  • possible duplicate of ["Object doesn't support this property or method" error in IE11](http://stackoverflow.com/questions/18829292/object-doesnt-support-this-property-or-method-error-in-ie11) – Mark Nov 03 '14 at 15:11
  • I set up and test and ran this in IE 11 and jQuery threw this error: "Object doesn't support property or method 'addEventListener' which already has an answer, here: http://stackoverflow.com/questions/18829292/object-doesnt-support-this-property-or-method-error-in-ie11 See if that helps! – Mark Nov 03 '14 at 15:12
  • For the record, opening up the Developers Tools when you are having this sort of problem (F12 key in Chrome and IE11) can get you to the Javascript Console, which will output errors in your script to the screen so you can more easily figure out what is happening: https://developer.chrome.com/devtools/docs/console – Mark Nov 03 '14 at 15:17
  • Thanks Mark but I tried the solution that you mentioned and it doesn't work either. Possibly because I am using PHP and that is a SharePoint solutions? Though I did try changing the extension to html just to see if it would work, and it still didn't. – trouble706 Nov 03 '14 at 15:59
  • @trouble706 Hmmm there is no reason why one of the solutions on that page wouldn't work for you. I setup a PHP page to test your code with (jsFiddle won't work for this, for a number of reasons) and I did indeed have the same problem but I did not test any of the solutions. I will look into it a little more and see if I figure anything out. – Mark Nov 03 '14 at 16:12
  • @trouble706 Can you try to provide the javascript console error that gets thrown in IE? You might also look here: http://stackoverflow.com/questions/20214242/jquery-is-undefined-exception-in-ie11 – Mark Nov 03 '14 at 16:16

1 Answers1

1

Apparently, it was a server issue. I used the method described on the link suggested by Mark. That didn't work on the development server so just to be sure, I tried it on the development server and it does work. Thanks Mark.

trouble706
  • 48
  • 3
  • 15
  • No problem, incidently enough I had similar problems until I switched to a local version of jquery: working in Chrome but not in IE. Dunno why. – Mark Nov 03 '14 at 16:22