Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/429.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript x-editable(jQuery UI构建)抛出未捕获的TypeError_Javascript_Jquery_Jquery Ui_Typeerror_X Editable - Fatal编程技术网

Javascript x-editable(jQuery UI构建)抛出未捕获的TypeError

Javascript x-editable(jQuery UI构建)抛出未捕获的TypeError,javascript,jquery,jquery-ui,typeerror,x-editable,Javascript,Jquery,Jquery Ui,Typeerror,X Editable,考虑以下代码: 在jQuery document.ready中: HTML: 这会引发未捕获的TypeError:This.tip(…).find不是jqueryui editable.js:4727中的函数 我认为这是因为与jQueryUI版本不兼容。但是我怎样才能避开它呢 更新:添加完整示例: <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <scr

考虑以下代码:

在jQuery document.ready中:

HTML:


这会引发未捕获的TypeError:This.tip(…).find不是jqueryui editable.js:4727中的函数

我认为这是因为与jQueryUI版本不兼容。但是我怎样才能避开它呢

更新:添加完整示例:

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

$(函数(){
$.fn.editable.defaults.mode='popup';
$(“#用户名”)。可编辑({
发送:“从不”,
成功:函数(响应,newValue){
userModel.set('username',newValue);//更新主干模型
}
});
});

我认为这是jqueryui 1.11.4特定源代码中的一个bug。 从2013年开始,jquery版本的源代码就没有被提及过,所以我认为它不会很快被修复。不幸的是,这是我发现的最实用的就地编辑库,所以我决定让它工作


一个不错的选择是使用“普通”版本的库,它根本不使用jqueryui。在我看来,它在功能上是等效的。如果您想使用“弹出”模式而不是“内联”模式,那么还需要抓取并包含我也有同样的错误,但通过使用较旧版本的jquery ui解决了这个问题。我使用的是v1.12.0,但注意到可编辑的演示使用的是1.10.1。使用jQueryUI的1.10.1版本允许我使用editable

我正在使用


问题中没有显示与jQuery UI相关的内容。创建一个演示,复制我正在使用的jQueryUI构建源的问题。因此,是的,它是相关的。理解它是相关的,但如果不能复制,这很难帮助现在我添加了一个完整的示例,可以作为HTML文件运行以复制错误。dmoe应该只包含复制问题所需的最小数量。那是文件的完整副本,不是一份。另外,最好使用像jsfiddle.net或plnkr.co这样的沙箱,人们可以在其中使用代码进行分叉和更改。这也为我解决了这个问题,感谢您提供了这些
<div class="editable">
     <a href="#" id="username" data-type="text" data-pk="1" data-url="/post" data-title="Enter username">superuser</a>
</div>
<!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>