I have been using jQuery for a few years now and really have had virtually no cross-browser issues until my latest project. I’m working on an Asp.NET site that uses quite a bit of jQuery throughout and I have run into the most perplexing problem. When using IE and only after a postback or when first going to the site (not when you just refresh the page) jQuery executes the .ready method correctly but then when any function bound to an event fires a few of the jQuery methods inside that function break. You can see this here. On all other browsers that I have tested the jQuery runs perfectly.
I just don’t know what else to try.
If you do go to the site the easiest way to see the error I am referring to is changing the location and then trying to change it again.
Thanks
<script type="text/javascript">
$(function () {
$('#ctl00_uxLocationSelect_uxLocationButton').button({
icons: { primary: 'ui-icon-flag', secondary: 'ui-icon-triangle-1-s' }
}).unbind('click').unbind('hover').click(function () {
var wrap = $(this).siblings('.locationDD-wrap').first();
if (wrap.is(':visible')) { // IE breaks here
wrap.slideUp(300, 'swing');
$(this).removeClass('ui-state-active');
}
else {
wrap.slideDown(500, 'swing');
GetCities(wrap.find('.citySelect-wrap').first(), wrap.find('.loading').first());
$(this).addClass('ui-state-active');
}
}).mouseout(function() {
$(this).addClass('ui-state-hover'); // IE breaks here
}).hover(function () {
$(this).removeClass('ui-state-hover'); // IE breaks here
});
$('#ctl00_uxLocationSelect_uxStateSelect').selectmenu().change(function () {
var loading = $(this).siblings('.loading').first();
var cityWrap = $(this).siblings('.citySelect-wrap').first();
GetCities(cityWrap, loading);
});
// Other functions omitted
});
</script>
This code is in the middle of the html but I have moved it around with no change. What is so strange is that the button(), click(), and other jQuery functions run normally…
EDIT: I just tried the site on my roommate’s machine and it seemed to work perfectly.. Could someone please try to go to http://www.thegameshuffle.com/ and change the location a few times and post what happens?
EDIT: I’m not using an update panel
It would seem that I have a faulty install of IE. After John Pick’s comment I attempted to re-install IE and see if that would resolve the problem. Unfortunately, I am still having issues on my own machine but since it works for ever other person I have had test then I’ll mark this as answered.