Highlight.js: How to highlight the content from ajax load?

Created on 27 Oct 2015  路  5Comments  路  Source: highlightjs/highlight.js

Most helpful comment

Like this:

$('pre > code').each(function() {
     hljs.highlightBlock(this);
});

All 5 comments

+1

Like this:

$('pre > code').each(function() {
     hljs.highlightBlock(this);
});

:+1: great.

@hojas it works

For people disliking jquery:

document.querySelectorAll('pre > code').forEach(function(el) {
    hljs.highlightBlock(el);
});
Was this page helpful?
0 / 5 - 0 ratings

Related issues

sumanstats picture sumanstats  路  5Comments

Lestoroer picture Lestoroer  路  7Comments

dlinx picture dlinx  路  5Comments

Vad1mo picture Vad1mo  路  7Comments

alainbryden picture alainbryden  路  4Comments