![](/img/trans.png)
[英]google-code-prettify doesn't add the classes to SPAN tags for Java code
[英]Dynamic google-code-prettify doesn't work
按钮是否可以调用一个能够“美化”动态<code><pre>
的函数? 我无法让它发挥作用。
页面加载后,初始<code>
被美化(?),但是当我更改它并之后调用prettyPrint()时,它不再有效。
示例: http : //jsfiddle.net/uwBjD/2/
编辑:对不起,我正在使用本地的prettify.js。 更新后,仍然遇到同样的错误。
显然,在代码被prettyprinted
之后,添加了一个额外的类,它是prettyprinted
。 任何具有prettyprinted
类的prettyprinted
都不会被重新prettyprinted
。 在调用函数之前,您需要删除该类:
$('input[type=button]').click( function() {
$("#jsExample").text(" var user = 'private'; //Do NOT store your API Key on a script.")
.parent().removeClass("prettyprinted");
prettyPrint();
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.