chronister Posted October 21, 2009 Share Posted October 21, 2009 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 Link to comment https://forums.phpfreaks.com/topic/178527-loop-through-array-and-make-1-big-string/ Share on other sites More sharing options...
cags Posted October 21, 2009 Share Posted October 21, 2009 newString = newString + copyText.innerText; Should work. Link to comment https://forums.phpfreaks.com/topic/178527-loop-through-array-and-make-1-big-string/#findComment-941523 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.