Jump to content

loop through array and make 1 big string


chronister

Recommended Posts

Hello all..

 

I suck at javascript and have been messing with this today throughought the last few hours little by little.

 

I have an array or collection of objects or whatever the term is. (they are strings of <p>TEXT HERE</p> tags)

 

I can loop through and get the innerText properly, but I am having trouble taking those and making a string out of each one.

 

I have this so far....

 

     

copyText = $(".copy p.copyString");     
         
        for(i=0;i < copyText.length; i++){
           newString = copyText.innerText;
        }  

 

If I print or alert the newString var, it contains the text I am trying to get to. How would I concatenate these into a string?

 

I have tried join, concat, using the + sign and I want to basically seperate them with a "\n"

 

Thanks for your help.

 

Nate

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.