Html.TextArea code example

Example 1: html textarea

<textarea id="txtid" name="txtname" rows="4" cols="50" maxlength="200">
A nice day is a nice day.
Lao Tseu
</textarea>

Example 2: html create a multi-line text input

<html>
 <head>
   <title>Textarea Elements</title>
 </head>
 <body>
   <form>
     <label for="multiLineInput"> <!-- Add the label if you want -->
       <p>This is an input element that can include new lines:</p>
       <textarea rows="5" cols="50" id="multiLineInput"></textarea>
     </label> 
     <!-- rows for length, cols for width. Both aren't required -->
   </form>
 </body>
</html>

Example 3: textarea rows cols

<textarea rows="4" cols="50">

Example 4: syntax is being placed in my textarea in html

<textarea name="comment" rows="5" cols="100"></textarea></br></br>

Example 5: textarea

<textarea></textarea>

Example 6: html set textarea value

// To set the textarea value, you must insert the TEXT into the element.
<textarea>VALUE</textarea>
// javascript
var textarea = `<textarea>${value}</textarea>`;
document.getElementById('my_textarea_id').textContent = 'foo'
// php
$value = 'foo';
$textarea = "<textarea>$value</textarea>";
echo $textarea;

Tags: