Sunday, May 19, 2024
 Popular · Latest · Hot · Upcoming
137
rated 0 times [  143] [ 6]  / answers: 1 / hits: 31711  / 12 Years ago, thu, june 14, 2012, 12:00:00

I am trying to split a string in javascript . it works fine in chrome, but it is not working in firefox



code



var a=1#abc;
var b=a.split('#');


The error on cole is TypeError: response.split is not a function



The response in firefox is not in string. It is as [Object XMLDocument] It is not being converted by toString() method. HowI can convert it in to string


More From » string

 Answers
17

I don't know what exaclty is happening but you can try to convert your variable into a string before splitting:



var a=1#abc;
var b=a.toString().split('#');

[#84911] Wednesday, June 13, 2012, 12 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
raveno

Total Points: 453
Total Questions: 92
Total Answers: 92

Location: France
Member since Thu, Oct 27, 2022
2 Years ago
raveno questions
;