What is meta? ×
Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 137 Stack Exchange communities.

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

1 Answer 1

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 .