Well, I am building an online source code editor and I use Snippet, a jQuery Plugin to make the highlighting. So, for now I have a textarea and a pre element, where I copy the textarea 's value to pre on each keyup... So I call the function .snippet(), on document.ready() and on each keyup in order to make the syntax highlighting. But I noticed that it won't work when I call it more than once on the same element. Check my code here: http://jsfiddle.net/parisk/YkNMh/. (It won't work on keyup cause I have called it once on document.ready(), if you disable the call on document ready then it 'll work only on the first keyup)... And I would really like to solve this issue. Thanks for your help!
The snippet plugin wraps the pre
element with a <div>
and also adds a class to it depending on the code style you choose.
Obviously they use those to check if the element has already be snippet'ed.
You will need to undo those changes, and a simple solution in your case is to change
$('pre').snippet("c",{style:"the",showNum:true});
to
$('pre').removeClass().unwrap().snippet("c",{style:"the",showNum:true});
example at http://jsfiddle.net/gaby/Kpphx/