I want to add word format in textarea | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

I want to add word format in textarea

with html n javascript I added only bold italic and underline but I can't add these things color font size and font style E.g :- whatever I want to write in textarea my name is susovan and I want "susovan" in red and "my" in font style and "name" for size whatever I want to <body onload="enableEditMode();"> <h1> Text Area !</h1> <div> <button onclick="execCmd('bold');"><i class="fa fa-bold"></i></button> <button onclick="execCmd('italic');"><i class="fa fa-italic"></i></button> <button onclick="execCmd('underline');"><i class="fa fa-underline"></i></button> <button onclick="execCmd('strikethrough');"><i class="fa fa-strikethrough"></i></button> </div> <iframe name="richTextField" rows="6" cols="40"></iframe> <script type="text/javascript"> function enableEditMode(){ richTextField.document.designMode = 'on'; } function execCmd (command){ richTextField.document.execCommand(command, false, null); } </script> can you help me out please thank you

19th Mar 2018, 2:21 PM
Susovan Das
Susovan Das - avatar
5 Answers
+ 7
Have a look at CKEditor https://ckeditor.com
19th Mar 2018, 3:00 PM
Louis
Louis - avatar
+ 5
Check that :-) 1- https://www.w3schools.com/html/html_styles.asp and hope you will complete the CSS course here and check this lesson: https://www.sololearn.com/learn/CSS/1086/
19th Mar 2018, 2:25 PM
Baraa AB
Baraa AB - avatar
+ 4
Different formatting/style requires multiple chunks of DOM. Therefore if you need to provide different formatting to the textarea, you can give a try like what @ihateonions and @Louis suggested. 😉
19th Mar 2018, 2:46 PM
Zephyr Koo
Zephyr Koo - avatar
+ 1
Are you talking about adding features for the user to select a bit of text within a textarea and make bold, italic, or a colour etc? If so, then try using something like the tinymce wysiwyg editor. Everything you require is included and you can even download an additional plugin to add more functions.
19th Mar 2018, 2:29 PM
ihateonions
+ 1
I don't want to use any framework or any kind of editor
19th Mar 2018, 4:22 PM
Susovan Das
Susovan Das - avatar