Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Aug 2013
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Breaking Each Line of Text Area

    Is this possible? I have spent hours looking through tutorials. I am very new to coding and for some reason just cant get this down.

    Basically what I trying to do is have a text box, and someone copies and pastes a list into it. I wanted to make each line in the textarea a variable.

    There are several text areas and basically I want to make it where when a person hits submit, every line is set into an array. I have tried to use JavaScripts to set </br> to the end of every line, but I don't know how to set it to do this every line.

    I've read a lot of resources and can't find it out, so chances are it's probably extremely easy and assumed. :/

    Thanks for reading,
    Rotavele

  • #2
    Senior Coder
    Join Date
    Sep 2010
    Posts
    1,903
    Thanks
    15
    Thanked 226 Times in 226 Posts
    Yes, and it's very easy. Here's a page where I'm using it to split lines in a textarea to make an array.

    http://www.myphotowizard.net/Canvas/index.php

    And here's the code I'm using.
    Code:
    var vals = theinput.split("\n");
    theinput is the texarea value, vals is the array.
    Have some fun with it.
    Welcome to http://www.myphotowizard.net

    where you can edit images, make a photo calendar, add text to images, and do much more.


    When you know what you're doing it's called Engineering, when you don't know, it's called Research and Development. And you can always charge more for Research and Development.

  • #3
    New to the CF scene
    Join Date
    Aug 2013
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by DrDOS View Post
    Yes, and it's very easy. Here's a page where I'm using it to split lines in a textarea to make an array.

    http://www.myphotowizard.net/Canvas/index.php

    And here's the code I'm using.
    Code:
    var vals = theinput.split("\n");
    theinput is the texarea value, vals is the array.
    Have some fun with it.
    Ah! I see my newbiness is showing. I have been learning a lot and guess I just had a coder's block :P. Thank you so much dear!


  •  

    Posting Permissions

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