• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Paul Clapham
  • Jeanne Boyarsky
Sheriffs:
  • Devaka Cooray
  • Junilu Lacar
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Ron McLeod
  • Tim Holloway
  • Claude Moore
  • Stephan van Hulst
Bartenders:
  • Winston Gutkowski
  • Carey Brown
  • Frits Walraven

separate data with comma separated values and store them in a array  RSS feed

 
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

My requirement is this that i have to iterate over the values which are comma separated and put them in a array so that i can iterate over them
again to put them in a dropdwon box.

Detailed:

I have a javascript function in which i gettting a var with values separated by ","(comma)

for e.g var data = TA,FA,SA,BA,SA;

Now i want to separate these values and store them in a javascript array(i.e dataArray) so that i can iterate those and put in dropdwon box using some thing like below.


where drpDwn is my var drpDwn = document.getElementById("id of the dropdown");

here is my addOption function.



so basically i need to know the way of separating the data and storeing them in the javascript array.
 
Prashant Langade
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey good news!!


I go the solution

var myArray = myString.split(",");

I need to use this in order to split the string.

Thanks and Regards
Prashant
 
Rancher
Posts: 377
Android Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey,

There is a js function [ib]split()[/b] function which will do this.
See http://www.w3schools.com/jsref/jsref_split.asp

Sean
 
This cake looks terrible, but it tastes great! Now take a bite out of this tiny ad:
ScroogeXHTML 8.2 - easy to use RTF to HTML converter library
https://coderanch.com/t/707504/ScroogeXHTML-RTF-HTML-XHTML-converter
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!