[jQuery] Internet Explorer 6 Not Running Code
Hi,
I'm not sure whether this is where to post this, but I have some
jquery code that runs in FF but is not executing in IE6.
function LoadFields()
{
if(this.id)
{
//some code
}
else // first load
{
// build the HTML options for the select fields and set $
('ddlType').html(options) and $('ddlUserGroups').html(options)
_LoadFields('ddlType', 'ddlUserGroups');
_LoadFields('ddlTypeS', 'ddlUserGroupsS');
//if I uncomment the line below the bug does not occur and
the setDefaults code runs in IE
//alert($.browser.msie); // alert 1
// defaults
$('#ddlType').val(pIssueEvent.ixService); // this line
runs in IE and FF
var setDefaults = function() {
alert('setting defaults'); // alert 3
if(pIssueEvent.ixPerson != -1)
{
$('#ddlUserGroups').val('U' +
pIssueEvent.ixPerson);
}
else if(pIssueEvent.ixGroup != -1)
$('#ddlUserGroups').val('G' +
pIssueEvent.ixGroup);
// literals
var currentService = $('#ddlType
option:selected').text().toLowerCase();
$('#titlePublicNotes').html('Please enter your notes
about this ' + currentService + ':');
$('#titleNotify').html('Notify others about this ' +
currentService + '?');
var scheduledService = $('#ddlTypeS
option:selected').text().toLowerCase();
$('#titleScheduled').html('Notes about this scheduled
' + scheduledService + ':');
};
// get around IE bug
if($.browser.msie)
{
alert('Internet Explorer, Delaying code so that DOM
loads'); // alert 2
setTimeout(setDefaults,1);
}
else
setDefaults();
}
}
If I uncomment alert 1 the problem doesn't occur and setDefaults runs
(including both alerts 2 and 3). If alert 1 is commented, neither
alert 2 or 3 run nor does setDefaults run.
I've moved the document.ready to the bottom of the page and it doesn't
help.
Any suggestions?