I'm having a problem where a jQuery setting against an .html() property on a selected element is returning the error 'nodeName' is null or not an object. This only occurs on IE6 and IE7, but not FF2, FF3, Opera (latest Nov 12,2008) or Safari (again, latest).
views:
2042answers:
3I resolved the problem. The example looks like this:
$('#section #detail .data').html(data);
...where data is HTML returned from an AJAX call, and this bug only occurs on IE6 and IE7 on the second attempt AJAX call, not the first. It's inexplicable. The error returned is:
'nodeName' is null or not an object
The fix is to simply clear the variable first before setting:
$('#section #detail .data').html(''); $('#section #detail .data').html(data);
And then IE6 and IE7 started working again with it.
BTW, I had to install Visual Web Developer 2008 Express Edition to get a debugger working in IE7. That info is here.
I don't know if it's connected, but we've had what sounds like a similar issue where the DOM doesn't have the children/text of a element that we know exist (because we see them rendered on the screen!)
Selecting something else, then selecting the elememt again seemed to fix the issue - suddenly, the children appear. So what happens if you select you element, select something else, select your element again?
Do you have any idea what kinds of nodes you might be running up against? Or, are you running in IE quirks mode? There might be some kinds of nodes such as #text that don't show up correctly in the DOM in quirks mode.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">