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 6 of 6
  1. #1
    New Coder
    Join Date
    Sep 2004
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Confused on getting input from textarea

    I want to get the text from a textarea and put it into a variable. How do I do this because eval didn't work for me.

  • #2
    Senior Coder
    Join Date
    Feb 2003
    Location
    Ontario, Canada
    Posts
    1,223
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Code:
    <textarea id="txtArea"></textarea>
    ...
    <script type="text/javascript">
    txt = document.getElementById ('txtArea').value;
    alert ('Text in text area: ' + txt);
    </script>

  • #3
    Banned
    Join Date
    Sep 2003
    Posts
    3,620
    Thanks
    0
    Thanked 0 Times in 0 Posts
    var myVariable = document.forms['myFormName']['myTextareaName'].value;

    .....Willy

  • #4
    New Coder
    Join Date
    Sep 2004
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Those still don't work.

  • #5
    Banned
    Join Date
    Sep 2003
    Posts
    3,620
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Rune Hunter
    Those still don't work.
    Can't tell from here...
    Obviously you are doing something wrong...
    Or do you think it is us that steered you wrong...

    .....Willy

  • #6
    Senior Coder
    Join Date
    Jun 2002
    Location
    Wichita
    Posts
    3,880
    Thanks
    0
    Thanked 0 Times in 0 Posts
    In case you don't understand the sarcasm: If you want useful help it's a really good idea to post a link to the defective code or at least post that code here so we can examine it for problems. We are not clairvoyant so we can't magically look over your shoulder, you have to give us something "real" to work with.

    See the link labeled "Posting Guidelines" for more information.
    Check out the Forum Search. It's the short path to getting great results from this forum.


  •  

    Posting Permissions

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