开发者

Need to make selected text as bold/italic/underline using javascript, or need very basic text editors suggestions

开发者 https://www.devze.com 2023-04-05 06:51 出处:网络
I am trying to figure out how to create a textarea with 3 buttons: bold, italic, underline. I cannot go with any WYSIWYG editor as I have tested most of them and no one fits my needs. (e.g. most are c

I am trying to figure out how to create a textarea with 3 buttons: bold, italic, underline. I cannot go with any WYSIWYG editor as I have tested most of them and no one fits my needs. (e.g. most are configurable and could give me the option to have the 3 buttons but problems come when I paste formatted text in the field. Even if I set everything up, with tinymce for example, I get problems.)

I really need a simple, basic, text editor with bold, italic, underline, and if I copy and paste formatted text in the textarea, I do not want it to act开发者_JAVA技巧 like a rich text editor, I want it to act like a real textarea, which will automatically remove ALL formatting. Peoples might say I could do it with properly-configured WYSIWYG editor but the answer is NO. I spent to many hours trying to configure the text editors to only accept bold, italic, underline and I got to many errors/bugs with all the well known WYSIWYG editors. I am not a programmer, I am a quality analyst so I'm used to find bugs.

Are there any suggestions on how to "create" a textarea with bold, italic, underline capabilities and that will only accept those functions? (not a rich text editor). With Javascript, I would like to avoid JQuery if possible.


Have you considered or tried Aloha editor: http://aloha-editor.org/ It is simple, HTML5 compatible and doesn't use iFrames. It does have problems in older versions of IE though.


TEXTAREA does not support formatting or any HTML tagging. There are no javascript tricks to change this.

You're going to have to roll-your-own or configure an existing editor.

0

精彩评论

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