SitePoint Sponsor

User Tag List

Results 1 to 4 of 4

Hybrid View

  1. #1
    SitePoint Enthusiast inderpal.singh's Avatar
    Join Date
    Jul 2006
    Posts
    61
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Populate TEXTAREA with array in javascript

    Hi All,

    I have a pre-populated array in a JavaScript. How to populate TEXTAREA field with the text from that array, each entry on different line on page load? Say, value at index 1 will come at line 1; value at index 2 will come at line 2 and so on.

    I would appreciate any help regarding this.

    Best Regards,
    Inderpal Singh

  2. #2
    SitePoint Guru
    Join Date
    Apr 2006
    Posts
    802
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    if A is an array of string values and T is a reference to your textarea:

    T.value= A.join('\n');

  3. #3
    SitePoint Guru
    Join Date
    Apr 2006
    Posts
    802
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    if A is an array of string values and T is a reference to your textarea:

    T.value=A.join('\n');

  4. #4
    SitePoint Enthusiast inderpal.singh's Avatar
    Join Date
    Jul 2006
    Posts
    61
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for your help.

    Best Regards,
    Inderpal Singh


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •