I am using the split function in JavaScript. It works fine in Firefox and Chrome, but IE displays an error when I call the split function. Is there a way to use other function like split?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
split Method
It’s fully supported by IE8
split method for JScript 5.6
It’s also fully supported by IE6
Live example using
.split(/\s+/)Tested in IE9 standards, IE9 IE8 mode, IE9 IE7 mode and IE9 quirks mode. All work.
Edit:
Turns out your actual problem is using
.textContent. This does not work in IE. There are two alternatives.Feature detection:
.nodeValue:
var str = el.nodeValue;