views:

130

answers:

2

Right now while I'm typing this theres the preview down below the editor. I would like to do something similair and am wondering how Stack Overflow does this? Thanks!

+5  A: 

They use an HTML editor called WMD Markdown Editor.

Brandon
does that handle the code snippet markup too then?
Zeus
Thanks, any idea how to remove the toolbar from the editor?
Shawn
Off the top of my head no, as I've never used it. But taking a look at the features section of their website, they say to look at optionsExample.html in the zip folder for configuration help.
Brandon
+1  A: 
$(function(){
    // whenever the text in the editor box changes:
    $("#editorTextArea").change(function(){
        // add the text to the preview box below
        // this certainly involves some formatting/marking up of the text
        // but this is good enough for illustrative purposes
        $("#previewBox").val(this.value);
    });
});
inkedmn
Doesn't work like that because the change Event is only fired after the blur event; or: change will only fire if the content has changed AFTER it lost its focus. If you want to update while typing, you pretty much have to go with the keydown Event.
Mike