Saturday, 14 September 2013

How to break a String by whitespace in javascript

How to break a String by whitespace in javascript

I have a String in a JSP
var="abcd efgh ijkl pqrs";
i am getting this string from a request attribute in a jsp. i want to
break this string by whitespace and strored in a variable. for example:
var newValue="abcd"; var newValue="efgh"; and want to use this value for
other purpose. document.getElementsByID("ID["+newValue+"]"; i want to do
this in javascript in a jsp. please suggest.
Thanks.

No comments:

Post a Comment