34

In html for textbox it can be hidden by using <input type="hidden" name="hide"/> but for TextArea if I want to hide how should I use?

Anyone help me please,

Thanks,

1
  • 9
    style="display:none;"
    – Sender
    Sep 7, 2012 at 7:54

5 Answers 5

72

Set CSS display to none for textarea

<textarea name="hide" style="display:none;"></textarea>
4
  • Thanks,but if I use like this it will not allow me to input the text into the textArea. Sep 7, 2012 at 7:56
  • 21
    And if you use type="hidden" on a input it allows you? Sep 7, 2012 at 7:56
  • Use Read Only in Text area. w3schools.com/tags/att_textarea_readonly.asp Apr 6, 2016 at 9:08
  • @ankit suthar Read Only will just make it read only, not hidden as topickstarter ask.
    – cooler
    Aug 31, 2017 at 8:23
25

An <input type=hidden> element is not a hidden input box. It is simply a form field that has a value set via markup or via scripting, not via user input. You can use it for multi-line data too, e.g.

<input type=hidden name=stuff value=
"Hello
world, how
are you?">

If the value contains the Ascii quotation mark ("), then, as for any HTML attribute, you need to use Ascii apostrophes (') as attribute value delimites or escape the quote as &quot;, e.g.

<input type=hidden name=stuff value="A &quot;funny&quot; example">
1
  • 1
    Spike Williams is exactly right. That is why, when transferring textarea data, use a textarea. ...CSS display:none works just fine. Dec 31, 2015 at 19:16
6

but is the css style tag the correct way to get cross browser compatibility?

 <textarea style="display:none;" ></textarea>

or what I learned long ago....

     <textarea hidden ></textarea>

or
the global hidden element method:

    <textarea hidden="hidden" ></textarea>       
1
3

<textarea name="hide" style="display:none;"></textarea>

This sets the css display property to none, which prevents the browser from rendering the textarea.

1
  • 1
    I haven't slept in like 30 hours. Totally mis-typed.
    – Kevin Wang
    Sep 7, 2012 at 7:55
2

use

textarea{
  visibility:hidden;
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.