1

I use IE 6 and 7. My project contains jQuery.js v.1.9.1 and jQuery UI v.1.9.2.

I have html page with jQuery calendar field:

... <input type='text' id='Birthday'> <!-- for only test purpose--> <input type='button' style="width: 100px;" value="Get value" id='getValue'> ... 

And javascipt file:

$(document).ready(function () { $('#Birthday').datepicker({showOn: "button"}); $('#Birthday').datepicker("setDate", new Date(1930, 0, 1)); $('#getValue').click(function(){ alert($('#Birthday').datepicker("getDate")); }); }); 

Then I edit input textbox (without open Calendar dialog) and set date to 01/01/1958 and click on button "Get value". Alert box will show 01/01/1930 (wrong date). I try to use .datepicker("refresh") command after "setDate" but result is same.

How fix jQuery UI setDate function for working in IE 6...10 ?

3
  • you have the problem that probably no developer here still use IE 6/7 :D Any reason why not using any modern browser? Even with compatibility view in IE8 this works fine. Commented Apr 16, 2013 at 8:51
  • Project requirements are that we must use IE 6,7 and higher. And project managers refused to stop supporting older versions of libraries :-( Commented Apr 16, 2013 at 9:03
  • 2
    I love it when project requirements mean developers spending more time making it work in IE6 than will ever be spent by real users actually using IE6. Meh. My guess is that it's throwing some kind of JS error, but IE6/7 isn't reporting it. Pity that IE6/7 don't have decent dev tools, but if you can get the same effect in a later IE version using IE7-compatibility mode then you could use the console to watch for errors and see what's happening. (If it doesn't happen in compat mode then you'll need to find another way to debug IE6/7... good luck with that!) Commented Apr 16, 2013 at 9:33

1 Answer 1

2

I fixed this problem by adding the onSelect parameter to Datepicker:

$('#Birthday').datepicker({ showOn: "button", onSelect: function() { // this will fire change on the underlying input $(this).change(); } }); 

This code works fine in IE 6/7/8/9.

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

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.