Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Value of textarea? how to fill one?

I am trying to fill a textarea using javascript, the thing is i found out that textarea doesn't have the value tag, and <textarea ..></textarea> is not an option since i cant use it with javascript.

Edit :

content.document.getElementsByName("cr-work-desc0").innerHTML = "125645";
content.document.getElementsByName("cr-work-urls0").textContent = "this is some sample text";
content.document.getElementsByName("infringing-urls0")[0].setAttribute("value","testing to");
like image 944
MNS Avatar asked Jun 11 '13 16:06

MNS


People also ask

How do I autofill textarea in HTML?

The HTML <textarea> autocomplete Attribute is used to specify whether the Textarea field has autocomplete on or off. When the autocomplete attribute is set to on, the browser will automatically complete the values based on which the user entered before.

Can we use value in textarea?

From the MDN documentation: " <textarea> does not support the value attribute".

How do you display the value of a text area?

Use the <textarea> tag to show a text area. The HTML <textarea> tag is used within a form to declare a textarea element - a control that allows the user to input text over multiple rows.

Can I put Div inside textarea?

You cannot place HTML elements inside a text area, only text content. only text content covers that part.


1 Answers

Try following code

document.getElementById("aa").innerHTML="Blah Blah";
<textarea id="aa"></textarea>
    

Both innerHTML and value works fine.

You can write anything in place of aaaa

like image 171
Hari Das Avatar answered Oct 13 '22 19:10

Hari Das