innerHTML vs value for TEXTAREA element

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • dr.bob

    #1

    innerHTML vs value for TEXTAREA element

    Hi :)

    i just discovered (in gecko-based browsers) that if i dynamically
    create a TEXTAREA and assign a string to its innerHTML, all works
    fine (my string is displayed inside the TEXTAREA once it's
    attached to some suitable place in the DOM tree); BUT if i
    grab an existing TEXTAREA t and replace t.innerHTML, nothing
    changes until i do the same replacement on t.value. is that a
    bug, or that's the way it's supposed to be?

    /dr.bob

  • Michael Winter

    #2
    Re: innerHTML vs value for TEXTAREA element

    On 27/05/2005 12:30, dr.bob wrote:
    [color=blue]
    > i just discovered (in gecko-based browsers) that if i dynamically
    > create a TEXTAREA and assign a string to its innerHTML[/color]

    You should really stop right there. TEXTAREA elements can only contain
    text and the expected way of accessing or modifying that data is via the
    value property.

    The fact that it implements the innerHTML property at all is
    conceptually odd, and probably best forgotten.

    An explanation for the behaviour you're seeing? I can't give you one,
    but it seems reasonable to assume a relationship to the above.

    [snip]

    Mike

    --
    Michael Winter
    Replace ".invalid" with ".uk" to reply by e-mail.

    Comment

    Working...