开发者

Formatted text in textarea

开发者 https://www.devze.com 2023-01-08 15:10 出处:网络
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?Yo

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

精彩评论

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