Html 隐藏文本区

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/12313961/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-29 02:43:05  来源:igfitidea点击:

Hidden TextArea

htmlcss

提问by user1606816

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?

在文本框的 html 中,它可以通过使用隐藏,<input type="hidden" name="hide"/>但对于 TextArea,如果我想隐藏我应该如何使用?

Anyone help me please,

有谁请帮帮我

Thanks,

谢谢,

回答by Mihai Iorga

Set CSS displayto nonefor textarea

设置CSSdisplaynone对文本区域

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

回答by Jukka K. Korpela

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>元素不是一个隐藏的输入框。它只是一个表单字段,它具有通过标记或脚本而不是通过用户输入设置的值。您也可以将它用于多行数据,例如

<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 orescape the quote as &quot;, e.g.

如果值包含 Ascii 引号 ("),那么,对于任何 HTML 属性,您需要使用 Ascii 撇号 (') 作为属性值分隔转义引号&quot;,例如

<input type=hidden name=stuff value="A &quot;funny&quot; example">

回答by Kevin Wang

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

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

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

这会将 cssdisplay属性设置为none,从而防止浏览器呈现 textarea。

回答by Sarthak Salunke

use

textarea{
  visibility:hidden;
}

回答by drtechno

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

但是css样式标签是获得跨浏览器兼容性的正确方法吗?

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

or what I learned long ago....

或者我很久以前学到的东西......

     <textarea hidden ></textarea>

or
the global hidden element method:


全局隐藏元素方法:

    <textarea hidden="hidden" ></textarea>