Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 158 Stack Exchange communities.

What is meta?
Here's how it works:
  1. Any Stack Exchange user can ask a question
  2. The community provides support, votes on ideas, and reports bugs
  3. Your voice helps shape the way Stack Exchange operates

I was wondering, how do the buttons above the textarea for questions and answers work?

What I mean is that upon a click on the button, the text in the textarea is modified, at exactly the position where the cursor is, or where some text is marked etc. How is that accomplished? Is that code downloaded from elsewhere, or was it developed for SO?

Also: The preview field reacts upon every keypress, is Markdown implemented in JavaScript?

share|improve this question

This is implemented using DOM ranges created from the current selection. The implementation differs between Internet Explorer and standards based browsers, but the end result is the same.

For more information:

The post creation editor is a customized WMD Editor, a markdown editor implemented in JavaScript. WMD provides the preview feature, as you can see from the demo.

share|improve this answer
Yeah, but I believe I've seen those buttons somewhere else, so my question is, is that SO code or taken from somewhere else, like TextArea Resizer or Markdown? – polemon Oct 4 '10 at 2:46
@polemon: are you perhaps confusing this with the (similar yet different) toolbar that textareas have over at Wikipedia? – ЯegDwight Dec 2 '10 at 20:50

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .