Javascript – ‘Undefined’ is null or not an object

internet-explorer-7, javascript

Hey guys having a strange problem basically all is fine in good old ff however ie7 is crying like a little baby and throwing the above error – char: 3, 'Undefined' is null or not an object .

I am splitting a string into a format I need to compare with another string. Once I have split the string I split it further – example below :

    noteDate = $(xml).find('entry:first published').text();    // split string to get the date - saved in realDate    var dateCheck = noteDate.split("T");    var realDate = dateCheck[0];    var timeCheck = dateCheck[1];     var lastSplit = timeCheck.substring(0, timeCheck.length-1);    var fullFeedDT = (realDate + " " + lastSplit); 

IE7 is currently moaning about the forth line however I have a feeling the problem may be with line 3 – due to the fact the error has 3 characters (char: 3).

If anyone can spot a problem please let me know would be greatly appreciated.


Best Solution

Your problem is most probably in the first line:

noteDate = $(xml).find('entry:first published').text();

For some reason, your XML data is not being loaded correctly in IE.