Wie füge ich der addClass-Methode von jQuery eine Callback-Funktion hinzu?
Ich verwende Prettify von Google und Markdown und möchte jedes Mal, wenn ich eine findepre
Code im Markdown hinzugefügttextarea
nochmal das anrufenprettyPrint()
Funktion.
Dies ist mein aktueller Code:
if($('#wmd-preview').length > 0) {
$('#wmd-preview').on('DOMNodeInserted DOMNodeRemoved',function(){
$(this).find("pre").not('.prettyprint').addClass("prettyprint");
});
}
Aber ich möchte so etwas wie:
$(this).find("pre").not('.prettyprint').addClass("prettyprint",function(){
prettyPrint();
});
Gibt es eine Möglichkeit, dies zu erreichen?