.load()之后的DOM操作

Trying to use Rainbow.js for syntax highlighting. I have a pagination navigation that, when being clicked, loads the page (#page2) into the body. It works great, but when I call Rainbow.color() (which searches the DOM for syntax inside pre-defined pre tags), it fails to color it. When the page first loads, I call this event:

$(window).load(function() {
    /* Act on the event */
    Rainbow.color();
});

And it works just fine! But when I call this function, Rainbow.color() does not highlight anything!

$('.pure-paginator .pure-button').on('click', function () {
    $('#content').load('html.html ' + $(this).attr('href'));
    Rainbow.color();
});

Help is appreciated, let me know if you need more code!

Ajax is async. Put your call in the ajax callback:

$('.pure-paginator .pure-button').on('click', function () {
    $('#content').load('html.html ' + $(this).attr('href'), function() {
        Rainbow.color();
    });
});