简体   繁体   English

在textarea中预览HTML标记

[英]Preview HTML markup inside textarea

How to transform html codes within textarea while typing, as text editors do? 像文本编辑器一样,如何在键入时在文本区域内转换html代码? I searched a lot, but preview is outside the textarea (which is very simple by jquery). 我搜索了很多内容,但是预览不在textarea范围内(jQuery非常简单)。 I want to know the trick text editors do to display formatted html inside the textarea! 我想知道技巧文本编辑器在文本区域内显示格式化的html!

Note that I do not want a text editor, I want to show markeup when typping; 注意,我不需要文本编辑器,我想在键入时显示markeup。 for example displaying BOLD when typing <b>BOLD</b> inside textarea. 例如在文本区域内输入<b>BOLD</b>时显示BOLD

textarea does not have such a feature. textarea没有这种功能。 However, you can still achieve the same effect with some Javascript acrobatics. 但是,您仍然可以通过一些Java杂技获得相同的效果。

Check this out: http://www.kevinroth.com/rte/demo.htm 检查一下: http : //www.kevinroth.com/rte/demo.htm

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM