GeekedOut
GeekedOut

Reputation: 17185

How do I make a rich text input box field like StackOverflow has?

I am working on a site that depends on user generated content, and it would be very nice to also have a way to let the users enter rich text.

How do they accomplish the rich text like they do on this site to post questions?

I understand that I can make arbitrary signs above the text area and when something is highlighted and one of the control buttons is pressed, make some jQuery call to see what is highlighted, and wrap that in some html tags like for bold text for example...and then just add the text into my database with the HTML. Is that how these kinds of rich-text things are done?

Thanks!!

Upvotes: 18

Views: 29972

Answers (2)

Phil
Phil

Reputation: 164826

StackOverflow uses Markdown to format user text. Check out PageDown for an editor / preview example.

Other options that produce HTML are TinyMCE and CKEditor.

Upvotes: 15

Brent
Brent

Reputation: 411

Check out TinyMCE. It's a great rich text input library.

http://www.tinymce.com/

Upvotes: 4

Related Questions