javascript - jquery.printElement 根本没有响应

标签 javascript jquery plugins

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

Uncaught TypeError: Cannot read property 'opera' of undefined

我使用的代码如下:

<!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>

有人知道为什么会发生这种情况吗?

最佳答案

printElement 插件在内部使用 jQuery.browser,并且 $.browser 已在您使用的 jQuery 版本中被弃用并删除。

您必须使用旧版本的 jQuery,或者可能使用迁移插件才能使 printElement 工作。

关于javascript - jquery.printElement 根本没有响应,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18354861/

相关文章:

javascript - 漂亮的照片集链接问题

plugins - PyCharm Docker部署 “[Errno 2] No such file or directory”

javascript - QuickConnect 与 Phonegap

javascript - 如何使用 v-for 在每个元素中呈现不同的 CSS 类

javascript - Li click 无法与 select2 插件一起使用

eclipse - 在 GWT 2.1.0.M2 中,无法识别选项 "-style pretty"

java - 如何检查Java Eclipse 插件开发中的IFile 是否真的存在?

javascript - 时刻 js 未定义 Laravel

javascript - 如何在刷新页面后继续将复选框保持在选中位置

php - 表单提交按钮未将名称传递给 php