jquery.printElement根本没有响应

Dor*_*bre 0 javascript jquery plugins

我一直在尝试使用jquery.printElement插件,但是当我单击Print链接时没有任何反应,除了控制台中的此错误消息:

未捕获的TypeError:无法读取未定义的属性"opera"

我正在使用的代码如下:

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Print</title>
</head>
<body>
    <p id="content">Some text to print</p>
    <a href="#" id="printIt">Print</a>
<script src="../common/js/jquery-1.10.1.min.js"></script>
<script src="../common/js/jquery.printElement.js"></script>
<script>
$('#printIt').click(function() {
    $('#content').printElement();
});
</script>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)

任何人都知道为什么会这样吗?

ade*_*neo 5

printElement插件在内部使用jQuery.browser,并且在您使用的jQuery版本中不推荐使用$ .browser并将其删除.

您必须使用旧版本的jQuery,或者可能使用migrate插件来使printElement工作.