Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
All-Star
30184 Points
4906 Posts
Feb 14, 2012 10:26 AM|LINK
Hi,
Try this-
<html xmlns="http://www.w3.org/1999/xhtml"> <head> <script type="text/javascript"> var globalFileTypeId = "jpeg, jpg, gif, png".split(','); alert("First value: "+globalFileTypeId[0]+"\n" +"Second value: "+globalFileTypeId[1]+"\n" +"Third value: "+globalFileTypeId[2]+"\n" +"Fourth value: "+globalFileTypeId[3]+"\n") </script> </head> <body> </body> </html>
asteranup
All-Star
30184 Points
4906 Posts
Re: How to get each value from a comma separated string in javascript?
Feb 14, 2012 10:26 AM|LINK
Hi,
Try this-
<html xmlns="http://www.w3.org/1999/xhtml"> <head> <script type="text/javascript"> var globalFileTypeId = "jpeg, jpg, gif, png".split(','); alert("First value: "+globalFileTypeId[0]+"\n" +"Second value: "+globalFileTypeId[1]+"\n" +"Third value: "+globalFileTypeId[2]+"\n" +"Fourth value: "+globalFileTypeId[3]+"\n") </script> </head> <body> </body> </html>Anup Das Gupta
Mark as Answer if you feel so. Visit My Blog