I have got two TextAreas and i want to use one toolbar. The toolbar should contain buttons for making the text in the textbox bold, italic, align to the left and right, add bullet points etc.. What I don't get is: how can I make the selected text in the textarea bold? I was using an iFrame before for writing text and used the iframe.contentDocument.execCommand()
for that purpose. But I think we can not use the execCommand() for a T开发者_运维技巧extArea. To make it simple, I am just trying to make something like a TextArea which is identical to the TextArea when we post questions on stackoverflow, with a toolbar above it! But I don't know how to do operations on the text!
You cannot use textarea, because textarea can only contain character data, that is unstructured text. Thus, all the contents of textarea have the same style.
That's why CKEditor, TinyMCE etc. use iframes.
精彩评论