innerHTML vs value for TEXTAREA element

D

dr.bob

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
 
M

Michael Winter

i just discovered (in gecko-based browsers) that if i dynamically
create a TEXTAREA and assign a string to its innerHTML

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top