473,387 Members | 1,760 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

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

Jul 23 '05 #1
1 12793
On 27/05/2005 12:30, dr.bob wrote:
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

--
Michael Winter
Replace ".invalid" with ".uk" to reply by e-mail.
Jul 23 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Phil N | last post by:
Hello again Site I'm working on: http://www3.telus.net/bikim/lightning/test/ - 'coach' & 'main' links swap innerHTML of div element - id 'textArea' works fine in NN7; IE6 reports 'Object...
2
by: Martin Turner | last post by:
Can anyone tell me why the following bit of code doesn't work in Netscape (6) but does in IE6 ? It is just an example which is supposed to toggle some text in both the <textarea> and <p> elements...
4
by: dekern | last post by:
I have been trying to set the default text value of a TextArea element for about a day now without any luck. Similar to the code used to set the Text field below I would like to use the returned...
4
by: Nick | last post by:
OK. I've had a trawl through past messages but can see nothing that helps me, so...here goes... I am writing a web application which, among other things, pushes a web page to a user's browser. ...
3
by: soup_or_power | last post by:
Hi Sorry about the heading. I have a table with td consisting of lists with <select></select>. When I do a document.getElementById("element").innerHTML I don't see the selected item. IOW, the...
8
by: McKirahan | last post by:
Firefox does not reflect selected option via innerHTML How do I get Firefox to reflect selected option values? <html> <head> <title>FFinner.htm</title> <script type="text/javascript">...
10
by: Jake Barnes | last post by:
This weekend I wanted to learn AJAX, so I set up a little toy page where I could experiment. The idea of this page is that you click in one of the boxes to get some controls, at which point you can...
2
by: xhe | last post by:
I met a very headache problem in javascript, I think this might be difference between IE and NS / Safari. I have a text area <form> <textarea name='tex1' onkeyup='displayit();'></textarea>...
4
by: theaj | last post by:
Hi all, im trying to change the CSS of an HTML element dynamically...for that purpose im taking help of innerHTML property. i have made the text on which CSS gets applied dynamically, editable,...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.