问题描述
如何在文本编辑器的输入过程中在textarea内转换html代码?我搜索了很多,但预览不在textarea(jquery非常简单)。我想知道文本编辑器在textarea中显示格式化html的技巧!
请注意,我不想使用文本编辑器,我想在打印时显示markeup;例如在textarea内输入< b> BOLD< / b> 时显示 BOLD 。 h2_lin>解决方案
textarea 没有这样的功能。然而,你仍然可以通过一些Javascript杂技来达到同样的效果。
检查一下:
How to transform html codes within textarea while typing, as text editors do? I searched a lot, but preview is outside the textarea (which is very simple by jquery). I want to know the trick text editors do to display formatted html inside the textarea!
Note that I do not want a text editor, I want to show markeup when typping; for example displaying BOLD when typing <b>BOLD</b> inside textarea.
textarea does not have such a feature. However, you can still achieve the same effect with some Javascript acrobatics.
Check this out: http://www.kevinroth.com/rte/demo.htm
这篇关于在textarea中预览HTML标记的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!