【发布时间】:2015-10-14 03:11:23
【问题描述】:
考虑以下代码:
jQuery document.ready:
$.fn.editable.defaults.mode = 'popup';
$("#username").editable({
send: 'never',
success: function(response, newValue) {
userModel.set('username', newValue); //update backbone model
}
});
HTML:
<div class="editable">
<a href="#" id="username" data-type="text" data-pk="1" data-url="/post" data-title="Enter username">superuser</a>
</div>
这会在 jqueryui-editable.js:4727 处抛出 Uncaught TypeError: this.tip(...).find is not a function。
我认为这是因为与 jQuery UI 版本不兼容。但是我该如何解决呢?
更新:添加完整示例:
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<script src="https://code.jquery.com/jquery-1.11.3.min.js"></script>
<link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css">
<script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
<link href="//cdnjs.cloudflare.com/ajax/libs/x-editable/1.5.0/bootstrap3-editable/css/bootstrap-editable.css" rel="stylesheet"/>
<script src="//cdnjs.cloudflare.com/ajax/libs/x-editable/1.5.0/jqueryui-editable/js/jqueryui-editable.min.js"></script>
<script>
$(function() {
$.fn.editable.defaults.mode = 'popup';
$("#username").editable({
send: 'never',
success: function(response, newValue) {
userModel.set('username', newValue); //update backbone model
}
});
});
</script>
</head>
<body>
<div class="editable">
<a href="#" id="username" data-type="text" data-pk="1" data-url="/post" data-title="Enter username">superuser</a>
</div>
</body>
</html>
【问题讨论】:
-
没有显示与 jQuery UI 相关的问题。创建一个复制问题的演示
-
我正在使用来自 https://vitalets.github.io/x-editable/ 的 jQuery UI 构建。所以是的,它是相关的。
-
了解它以某种方式相关但无法复制这很难提供帮助
-
现在我添加了一个完整的示例,您可以将其作为 HTML 文件运行以复制错误。
-
一个 dmoe 应该只包含复制问题所需的最少数量。这是文档的完整副本,而不是 MCVE 。最好使用像 jsfiddle.net 或 plnkr.co 这样的沙箱,人们可以在其中使用代码进行分叉和更改
标签: javascript jquery jquery-ui typeerror x-editable