Gai*_*sei 9 javascript google-code-prettify
按钮是否可以调用一个能够"美化"动态的功能<code><pre>?我无法让它发挥作用.
页面加载后,初始化<code>是美化(?),但是当我更改它并之后调用prettyPrint()时,它不再起作用.
示例:http://jsfiddle.net/uwBjD/2/
编辑:对不起,我正在使用本地的prettify.js.更新后,仍然遇到同样的错误.
Jam*_*gne 18
在代码被美化之后,显然会添加一个额外的类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();
});
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
5230 次 |
| 最近记录: |