How do I include make an html textarea dynamic? For example I want javascript to print text into the textarea. I've been trying this but it isn't working. Is this the write way or is there a better way to do this? Html code: <textarea name="chatoutput" cols="30" rows="20" disabled readonly="readonly"><div id="div_chattext"></div></textarea> Code (markup): Please help.
Why do you want to write <div id="div_chattext"></div> in the textarea? Maybe there is a better way to do what you want.
I don't know if there is a better way to do what I want but mabye you can suggest one. This is what I want to do. I want to get html code and simple text from a text file and output it into the textarea, so that the user can read the data from the text file and click the html links. The textarea's for format so the text doesn't just print straight down the screen. I've already tested all my code using div tags but now I want to output the data into the textarea. How do I do this. I've been trying something like this (I'll only show the relevent parts): Html Code: <textarea name="output" id="output" cols="30" rows="20" readonly="true" disabled></textarea> Code (markup): Javascript Code: document.getElementById('output').innerHTML = xmlhttpget.responseText; Code (markup): PHP Code: ECHO("$thedata"); Code (markup): Thanks. ~imozeb
To put it briefly, you want to display html code in the textarea and you want textarea for editing the text, do you?
Then what are you using a textarea for? Sorry, but that sounds more like a DIV's job... Given your using AJAX to retriece the info and stuffing it in via innerHTML - again, it SOUNDS like a job for a DIV, not a textarea.
Thanks everyone. I have done some more research and found a few commands to use with the div tag to do what I want.