我可以在< textarea>内部嵌入HTML格式吗?标签? [英] Can I embed HTML formatting inside of a <textarea> tag?

查看:94
本文介绍了我可以在< textarea>内部嵌入HTML格式吗?标签?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我有一个像这样的 textarea 块...

 < textarea name =myTextAreacols =100rows =20readonly = readonly> 
..文本区域内容...
< / textarea>

如何在此文本块中嵌入HTML格式的文本?如果我能想到以下内容应该可行......

 < textarea name =myTextAreacols =100 rows =20readonly =只读> 
< b>今天你好吗?< / b>
< / textarea>

举个例子。但是这句话并没有显示为粗体。也许我只是想做一些无法做到的事情?

我很确定答案是否定的 - - 不能使用textarea。



MDN文档


HTML< textarea&在线纯文本编辑控件。


  • 允许的内容文字



If I have a textarea block like so...

<textarea name="myTextArea" cols="100" rows="20" readonly=readonly>
.. text area content ...
</textarea>

How can I embed HTML formatted text inside this text block? If I can I had figured the following should work...

<textarea name="myTextArea" cols="100" rows="20" readonly=readonly>
<b>Hello how are you today?</b>
</textarea>

As an example. But that sentence does not show up as bold. Maybe I'm just trying to do something that can't be done?

解决方案

I am pretty sure the answer is no -- cannot do it with a textarea.

From the MDN docs:

The HTML <textarea> element represents a multi-line plain-text editing control.

  • Permitted content Text

这篇关于我可以在&lt; textarea&gt;内部嵌入HTML格式吗?标签?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆