« Caffe Latte Enabler | Main | Warnings for the Temporarily Irish »
File Under: "Why Didn't I Think of This?" - March 16, 2005

I stumbled on this really great idea last night: Live Previewing. Take the text you're typing into a textbox or textarea and insert it into a <div> tag somewhere on the page. Update on "onkeyup" events.

You can try it in the comments section right now -- just check "Live Preview" and type some text in the comment field. Add a few HTML tags -- links, images, whatever. It's all instantly previewed. The effect is really only about 5 lines of javascript, with an extra few lines of xhtml.

As a note, this behaves better in Firefox than IE, which spasms around on incomplete tags until they're fully typed in.

What I'd like to do with this is create a Markdown style parser so users don't have to know HTML. Maybe combine it with a certain library to let users write blog entries in real time directly onto their front pages. Sound good?

Posted by eric at March 16, 2005 10:36 AM

Comments

This is a "Live Preview" test. What's funny is that the text that shows in the preview frame is more accurate that the text shown when you click "preview" -- it automatically insert linebreaks.

It needs a little tweaking -- the user will always be able to break the page layout or maybe even perform some sort of script injection.

I'm afraid this is what was preoccupying me when I walked into the coffee shop last night. Doesn't matter if you're a geek with a problem on the brain or a deer in the high beams, the effect is the same. ;)

Posted by: Eric at March 16, 2005 10:53 AM