Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8100915
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T22:51:42+00:00 2026-06-05T22:51:42+00:00

I have string. I then split the string to make an array. I use

  • 0

I have string. I then split the string to make an array.

I use .each() to hopefully iterate through the array one by one and produce a certain output.

However, when I try to do this, I only get the value in the array outputted.

How comes?

I have set up a jsfiddle to demonstate what I have tried so far and the result I am getting:

http://jsfiddle.net/S7Z6K/2/

var string = 'this is a string';
stringArray = string.split('');

$.each(stringArray, function(index, value){
    $('#output').text(index + ' : ' + value);
});​

I am trying to achieve it where user inputs text, clicks submit and it returns there input to them, but every time they click submit it replaces the current output.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T22:51:43+00:00Added an answer on June 5, 2026 at 10:51 pm

    see here http://jsfiddle.net/S7Z6K/4/ or http://jsfiddle.net/S7Z6K/6/

    You are overwriting the old result set with .text

    In the code you can see I am appending old result set to new one’s hence everything appears fine.

    hope this helps!

    code

    var string = 'this is a string';
        stringArray = string.split('');
        var hulkfoo = "";
        $.each(stringArray, function(index, value){
            hulkfoo += index + ' : ' + value + " -- "; 
            $('#output').text(hulkfoo);
        });​
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Let's say I have this string var: string strData = 1|2|3|4||a|b|c|d Then, I make
I have some html extracted to a string var, and want to then use
I have this code that makes a string and then echos the loop out
Say I have a string. Then I have a number of unique tokens or
I have a doubt that when I am converting a String to date then
I have made a string vector vector<string> actor_; and then added elements in it
I have a function that writes a bitmap string to a browser, which then
I have this function called ProperCase that takes a string, then converts the first
I have used the following code to set cookie and then redirect. String level=(String)
I have a question that can I use AS400ConnectionPool in Spring if then pls

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.