简体   繁体   English

未捕获的类型错误:r.getClientRects 不是函数 jquery.min.js:2

[英]Uncaught TypeError: r.getClientRects is not a function jquery.min.js:2

Hi I don't understand what the meaning of the error is in the web console.嗨,我不明白 Web 控制台中错误的含义。

Uncaught TypeError: r.getClientRects is not a function jquery.min.js:2

I am trying to build an autocomplete search form in laravel Based on a bootstrap theme i downloaded.我正在尝试根据我下载的引导程序主题在 laravel 中构建一个自动完成搜索表单。

It works but the dropdown is misaligned to the text box I suspect JQuery because of that error and the fact that in a different bootstrap theme I had, it worked I have my script links as follows它有效,但下拉列表与我怀疑 JQuery 的文本框未对齐,因为该错误以及在我拥有的不同引导程序主题中,它有效我的脚本链接如下

<link href="http://myurl.com/vendor/bootstrap/css/bootstrap.min.css" 
rel="stylesheet">
<link href="http://myurl.com/vendor/fontawesome-free/css/all.min.css" 
rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Varela+Round" 
rel="stylesheet">
<link href="https://fonts.googleapis.com/css 
rel="stylesheet">
<link href="http://myurl.com/css/grayscale.min.css" rel="stylesheet">
<script src='https://www.google.com/recaptcha/api.js'></script>
<script src="http://myurl.com/vendor/jquery/jquery.min.js"></script>
<script 
src="http://myurl.com/vendor/bootstrap/js/bootstrap.bundle.min.js"> . 
</script>
<script src="http://myurl.com/vendor/jquery- 
easing/jquery.easing.min.js"></script>
<script src="http://myurl.com/js/grayscale.min.js"></script>

My form:我的表格:

 <form class="form-inline d-flex">


            <input class="form-control autocomplete_txt input-lg flex-fill mr-0 mr-sm-2 mb-3 mb-sm-0" 
                   type='text' data-type="EmpService" id='EmpService_1' name='EmpService[]' autocomplete="off" placeholder="looking for...">

                       <button type="submit" class="btn btn-primary mx-auto">Search</button>
             <div class="col-xs-4 g-recaptcha" data-sitekey="6Lf9mW4UAAAAACtNJIuXY9VlCZ5kg0Ys7Y3ancH_"></div>   

</form>

My Javascript:我的Javascript:

$(document).on('focus','.autocomplete_txt',function(){
  type = $(this).data('type');

  if(type =='EmpService' )autoType='EmployeeService'; 



   $(this).autocomplete({
       minLength: 0,
       source: function( request, response ) {
            $.ajax({
                url: "http://spanibox.com/searchajax",
                dataType: "json",
                data: {
                    term : request.term,
                    type : type,
                },
                success: function(data) {
                    var array = $.map(data, function (item) {
                       return {
                           label: item[autoType],
                           value: item[autoType],
                           data : item
                       }
                   });
                    response(array)
                }
            });
       },
       select: function( event, ui ) {
           var data = ui.item.data;           
           id_arr = $(this).attr('id');
           id = id_arr.split("_");
           elementId = id[id.length-1];
           $('#EmpService_'+elementId).val(data.name);

       }
   });

The problem is likely due to using jQuery 3.1.问题很可能是由于使用 jQuery 3.1。 Try to add :尝试添加:

<script src="https://code.jquery.com/jquery-migrate-3.0.0.min.js"></script>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 类型错误:r.getClientRects 不是函数 - TypeError : r.getClientRects is not a function jquery.min.js:2未捕获的TypeError:$(…).select2不是函数 - jquery.min.js:2 Uncaught TypeError: $(…).select2 is not a function 错误:jQuery jquery.min.js?_ = 1420285687057:4未捕获的TypeError:未定义不是函数 - Error: jQuery jquery.min.js?_=1420285687057:4 Uncaught TypeError: undefined is not a function 可能是“ jquery.min.js:2 Uncaught TypeError:Can not read property&#39;each&#39;of null”的原因? - What could be the cause for “jquery.min.js:2 Uncaught TypeError: Cannot read property 'each' of null”? jquery.min.js:2 Uncaught TypeError: Cannot read property 'replace' of undefined (javascript)(laravel) - jquery.min.js:2 Uncaught TypeError: Cannot read property 'replace' of undefined (javascript)(laravel) 将 jQuery 转换为 Vue - 未捕获的 TypeError:n.getClientRects 不是函数 - Converting jQuery to Vue - Uncaught TypeError: n.getClientRects is not a function $(...).modal 不是 function jquery.min.js - $(…).modal is not a function jquery.min.js 与Jquery.min.js发生功能冲突 - Function Conflict with Jquery.min.js 未捕获的SyntaxError:意外的令牌&lt;jquery.min.js:1 - Uncaught SyntaxError: Unexpected token < jquery.min.js:1 jquery.min.js冲突 - jquery.min.js Conflicts
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM