Yet another reason why I hate IE for being different. I’ve got this code:
var friends = document.getElementById('friendsEmail').value;
...
var emailArray=new Array();
emailArray=String(friends).split(','); //error here
This works in every other browser. In fact I only added the Array declaration and the explicit String conversion to get this to work in IE. However, I’m still getting this error
Webpage error details
User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1;
Trident/4.0; .NET4.0C; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152;
.NET CLR 3.5.30729; .NET4.0E; .NET CLR 1.1.4322) Timestamp: Wed, 1 Feb
2012 22:24:15 UTCMessage: Object doesn’t support this property or method Line: 59 Char:
4 Code: 0
What does IE not like about this? Am I doing something obviously stupid that I’m not seeing?
EDIT
This is what I did originally that resulted in IE errors:
var emailArray=friends.split(',');
This also gives me errors in IE
EDIT 2
I’m sorry guys. Turns out that the server was caching an older copy of the .js file and the error line I was looking at was incorrect… I apologize for wasting your time with this. The error turned out to be on a completely different line. For those who are curious it was actually failing because of this line
emailArray[count]=emailArray[count].trim();
I’ve already resolved that issue though.
The constructors for primitive types are usually not recommended. You already have a string in your
friendsvariable, so just split thatChange
to