我正在使用 PHP 来填充文本区域:
<textarea text-input" id="Desc" rows="15" wrap="soft" name="Desc"><?php echo $Desc; ?></textarea>
但文本区域显示 HTML 标签,这是我不想要的。
<b>Analog And Digital System</b><br />
<b>Analog System:</b><br />
A string tied to a doorknob would be an analog system. They have a value that changes steadily over time and can have any one of an infinite set of values in a range. If you put a measuring stick or ruler at a specific point along the string, you can measure the string's value every so many seconds at that point. When you watch it move, you will see it moves constantly. It doesn't instantly jump up and down the ruler. <br />
<br />
<b>Digital System:</b><br />
A digital system would be to flick the light switch on and off. There's no 'in between' values, unlike our string. If the switch you are using is not a dimmer switch, then the light is either on, or off. In this case, the transmitter is the light bulb, the media is the air, and the receiver is your eye. This would be a digital system.<br />
基本上我想做的是转换<b>
标签使内容加粗<br>
标记到新行。
我想在不使用任何编辑器的情况下完成它。
如果您只想显示 HTML 输出,请使用div
标签而不是textarea
。因为,我们无法在 a 中显示渲染的 HTMLtextarea
.
如果您想显示 HTML 输出并希望其可编辑,请使用contenteditable
属性上div
tag.
更多关于contenteditable
它的支持可以在以下位置找到
https://developer.mozilla.org/en-US/docs/Web/HTML/Content_Editable
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)