0

Why my code doesn't work on Internet Explorer:

enter image description here

64 line start here:

$(function () {
    $('#id_laufzeit_bis').datepicker().on('changeDate', recalculate_deadline);
    $('#id_kuendigungsfrist').change(recalculate_deadline);
    $('#id_kuendigungsfrist_type').change(recalculate_deadline);

    $('#id_kuendigung_moeglichbis').change(check_reminder_date);
    $('#id_erinnerung_am').datepicker().on('hide', check_reminder_date);

    //$('#id_vertrag_verlaengerung').change(recalculate_deadline);
    //$('#id_vertrag_verlaengerung_type').change(recalculate_deadline);
});

Full code here: http://wklej.org/hash/a8884a307f3/

user1966421
  • 163
  • 1
  • 2
  • 10

2 Answers2

3

If you open a JavaScript (.js) file directly in Internet Explorer, it is run at a (somewhat restricted) system level on Windows Script(ing) Host (WSH) it does not have any link to your HTML site at this point and so jQuery is missing and this error is thrown.

  • Press F12 to open the Web Developer tools on Internet Explorer. Then reload your site again.

As a web developer you may also want to always enable showing scripting errors without the developer console:

  • In the Advanced tab of the Internet Options dialog, there is a checkbox to enable displaying of scripting errors.
dualed
  • 10,262
  • 1
  • 26
  • 29
  • Thanks, but If I press F12 and refresh the page all js/jquery functions works. If I closed F12 (web developer tools) my js/jQ function still doesn't work. Why? – user1966421 Jan 23 '13 at 09:14
  • Showing or hiding the devtools should not change how the JavaScript is evaluated. However, like I suggested, you can enable displaying of scripting errors to make sure. Then you can close the devtools and reload to see if there is a scripting error (it's a quite visible popup). If there is none and you can't figure it out you should probably open a new question where you can explain what exactly "does not work" – dualed Jan 23 '13 at 09:27
  • http://stackoverflow.com/questions/13708841/form-works-in-internet-explorer-only-when-i-hit-f12-to-bring-up-console and http://stackoverflow.com/questions/7602277/ie-runs-javascript-only-after-pressing-f12 – user1966421 Jan 23 '13 at 12:24
0

It looks like you have an issue with jquery-ui library. It seems that you are trying to access the datepicker method before it has been defined and is available.

I made this piece of code working on IE 8 by using document.ready as

$(document).ready(function() {  
 $('#id_laufzeit_bis').datepicker().on('changeDate', recalculate_deadline);
});

See full working page @ http://jsfiddle.net/n7fMK/1/

Hope this helps.

Community
  • 1
  • 1
Seb T.
  • 1,104
  • 12
  • 27