I am trying to apply prettify syntax highlighting to a generated string when the dropdown box is selected. It works fine if the text was placed before-hand, but if it is generated, the text is not highlighted. I've tried calling prettyPrint() function but it still does not work.
$('#db').change(
function(){
query = "";
query = "<pre class=\"prettyprint\" id=\"query\">Insert Into ";
query = query + $('#db').val() + "</pre>";
document.getElementById("pp").innerHTML = query;
prettyPrint();
$.ajax({
url: "functions.php?&f=table",
type: "GET",
data: { db: $('#db').val() }
})
.done(function(result) {
$('#table').html(result);
})
.fail(function() {
alert( "error" );
});
}
);