Skip to content Skip to sidebar Skip to footer

Dynamic Google-code-prettify Doesn't Work

Is it possible for a button to call a function that would 'prettify' a dynamic
? I can't get it to work. After the page loads, the initial  is pr

Solution 1:

Apparently after the code is prettified, an additional class is added which is prettyprinted. Anything with the class of prettyprinted is not re-prettified. You need to remove that class before recalling the function:

$('input[type=button]').click( function() {
    $("#jsExample").text("    var user = 'private'; //Do NOT store your API Key on a script.")
        .parent().removeClass("prettyprinted");

   prettyPrint();
});

http://jsfiddle.net/uwBjD/3/

Post a Comment for "Dynamic Google-code-prettify Doesn't Work"