My delegate not running?

My delegate not running?

i am trying to reproduce the same effect as StackOverflow's add question page. where their WMD/markdown editor will dynamically update the preview. i want to use prettify to have syntax coloring on my <code> blocks.

i tried

  1. $("#main").delegate("code", "ready", function() { ... does not run ... }
if i try changing ready to hover, it runs. my idea is to when code blocks are generated on the page, attach the class "prettyprint" to them to trigger syntax coloring