jQuery AJAX call with datePicker working everywhere except IE 6, 7
I am having a tough time figuring out why this piece of jQuery code isn't working in IE 6 or 7:
$("#date").datepicker({
dateFormat: "mm-dd-yy",
altFormat: "yy-mm-dd",
altField: "#realdate",
onSelect: function(dateText, inst) {
$("#tcontainer").animate({"opacity" : 0}, 500, function() {
$.post("index.php", {date: $("#realdate").val()}, function(data) {
data = $(data).find("#maintable");
$("#maintable").html(data);
$("#maintable tr:odd").addClass("alt");
$(".stripe tr").hover(function() {
$(this).addClass("trhover");
}, function() {
$(this).removeClass("trhover");
});
$("#tcontainer").animate({"opacity": 1}, 500);
});
});
}
});
开发者_StackOverflowI've tried changing out the animate() methods with fadeIn/fadeOut and show/hide, and that didn't work. I tried not doing any animation at all, and that didn't work.
Does anyone have any ideas why this is not working in IE 6 and 7? It works everywhere else.
Thanks!
I would just like to let everyone know that I solved the problem that was happening with IE 6 and 7 and would like to share the solution with everyone. These were the two lines causing the issue - data = $(data).find("#maintable"); and $("#maintable").html(data); What was happening was I thought I was replacing the new data from the AJAX request into the table while replacing the whole table itself at the same time. What was really happening was the code above was placing #maintable inside of the existing #maintable, so there were really two tables. I had thought that by doing the code above, it would have just overwritten the table that was there along with the new data, but that was not the case. I created a div with an id of adminarea (or something like that) and modified the two lines to look like this:
data = $(data).find("#maintable");
$("#adminarea").html(data);
I hope that this is helpful to someone out there that may run across the same issue. Thanks again to everyone who helped!
精彩评论