SitePoint Sponsor

User Tag List

Results 1 to 5 of 5

Hybrid View

  1. #1
    SitePoint Wizard
    Join Date
    Oct 2005
    Location
    London
    Posts
    1,678
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    accessing text in textarea

    hi, im trying to access text in a textarea via the DOM. the textarea id is area Ive tried:

    Code JavaScript:
    var myvar = document.getElementById("area");
    var area_text = myvar.TextNode;
    but it doesnt seem to work....can anyone clarify this for me?

    Thanks

  2. #2
    SitePoint Evangelist hexburner's Avatar
    Join Date
    Jan 2007
    Location
    Belgium
    Posts
    591
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Just use textarea.value...
    Code JavaScript:
    var myvar = document.getElementById("area");
    var area_text = myvar.value;
    FOR SALE: 1 set of morals, never used, will sell cheap

  3. #3
    SitePoint Wizard
    Join Date
    Oct 2005
    Location
    London
    Posts
    1,678
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ahh....i see. Thanks hexburner

  4. #4
    SitePoint Wizard Pepejeria's Avatar
    Join Date
    Jan 2005
    Location
    Too far up north
    Posts
    1,566
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I am just curious, where did you get TextNode from? A simple google search would have give you what you looked for.

  5. #5
    SitePoint Wizard
    Join Date
    Oct 2005
    Location
    London
    Posts
    1,678
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    Yeah you're probably right and i did do a search for "accessing text in a textarea javascript" but it gave me links on how to access selected text in a textarea...so i just posted....maybe i shoulda looked harder

    Anyways it doesnt work in this instance as its part of a ajax function. The ajax loads text in to a textarea for editing. I need a way to get at the edited version of the text and get it in to a javascript variable. At present all it does it get the version that was originally loaded in to the textarea before editing......

    Any ideas how to do that?


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
  •