I'm using Prettify from Google and Markdown and I want each time I find a pre
code added in the markdown textarea
to call again the prettyPrint()
function.
This is my actual code:
if($('#wmd-preview').length > 0) {
$('#wmd-preview').on('DOMNodeInserted DOMNodeRemoved',function(){
$(this).find("pre").not('.prettyprint').addClass("prettyprint");
});
}
But I want something like:
$(this).find("pre").not('.prettyprint').addClass("prettyprint",function(){
prettyPrint();
});
Is there any possible way to achieve this?
pre
element without aprettyprint
css class. I don't want to call it each time is rased thedomnodeinserted
ordomnoderemoved
events, but only in the case described above. – Epimenidesprettyprint
class? – TacheaddClass
function with your own that will fire a custom event (but that won't help here, so...) – CanonicalIt should be called each time is found a new pre element without a prettyprint
Do you mean that it should happen when newpre
element is added to a DOM? – Tache