开发者

Formatted text in textarea

If I have a string

<b>This Is In Bold Letters</b>

then how can I include in a <textarea> so t开发者_如何学编程hat the string appears in BOLD letters, using javascript & PHP?


You cannot do this with a standard html textarea.

There are ways to do it, though:

http://ckeditor.com

http://www.webwiz.co.uk/webwizrichtexteditor/


The simplest solution to your problem is via CSS. Let me give you an example.

<html>
<head>
<title>Your Solution</title>
<style>
.boldText {
 font-weight:bold;
}
</style>
</head>
<body>
<textarea>No CSS</textarea>
<textarea class="boldText">With CSS</textarea>
</body>
</html>


You have to use an WYSIWYG editor, or implement a solution like here in stackoverflow: a textarea to write and a div to preview formatted text.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜