How to make selected text bold/italic/underlined in javascript?

后端 未结 3 1744
生来不讨喜
生来不讨喜 2020-12-31 18:40

I\'m trying to work on a webpage that allows users to write their own notes for a school project, and my idea was to let them bold/italicize/underline their text using butto

3条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-31 19:47

    Textarea does not allow such things. I would suggest you to use something like ckeditor. It will do the job for you neatly. But if you still want to do it yourself, you need to use a div with contenteditable tag.

    Good Luck !

提交回复
热议问题