I have a textarea I use as a form on a website.
I usually use place "placeholder" text inside, but I need this information to come up editable.
What I used to do was just feed info from my database into the "value" attribute of the form. The form would then just pop up with my data, ready to be edited.
For some reason though its not working with my textarea!
Here is my code:
<textarea value='<?php echo $info?>' class="form-control" id="message" name="message" rows="5"></textarea>
I know its not the data because iv echoed it elsewhere and its fine. I also tried
<textarea value='hi' class="form-control" id="message" name="message" rows="5"></textarea>
with nothing showing up.
Whats going on ? I used to do this all the time. Im using bootstrap 3, could it have something to do with that ?
<textarea> does not support the value attribute.
To add a value into a textarea, you can add to the value property of the input via document. getElementById. Reference this element and change the value: document.
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. Specifies that on page load the text area should automatically get focus.
Note − By default, we can enter data in a textarea upto 5,24,288 characters. In some cases, there is a need of putting a limit on the size of characters that can be typed in a textarea. So in that case, we can use maxlength attribute to control the number of characters entered in a textarea.
<textarea>
tag doesn't have value
attribute http://www.w3schools.com/tags/tag_textarea.asp Content should be placed between opening and closing tags
<textarea class="form-control" id="message" name="message" rows="5">hi</textarea>
In order to put some text in a textarea you should write something like
<textarea class="form-control" id="message" name="message" rows="5">hi</textarea>
or
<textarea class="form-control" id="message" name="message" rows="5">
<?php echo $info ?>
</textarea>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With