简体   繁体   English

未捕获的类型错误:elem.getClientRects 不是在 MVC 上使用多选时的函数

[英]Uncaught TypeError: elem.getClientRects is not a function when using multiple select on MVC

Uncaught TypeError: elem.getClientRects is not a function
    at F.fn.init.offset (jquery-3.2.1.js:9984)
    at init._position (kendo.all.js:25000)
    at init.open (kendo.all.js:24855)
    at init.open (kendo.all.js:31282)
    at init._wrapperMousedown (kendo.all.js:31186)
    at HTMLDivElement.proxy (jquery-3.2.1.js:496)
    at HTMLDivElement.dispatch (jquery-3.2.1.js:5206)
    at HTMLDivElement.elemData.handle (jquery-3.2.1.js:5014)

I was trying 2 ways such as HTML and MVC on http://demos.telerik.com/kendo-ui/multiselect/index我在http://demos.telerik.com/kendo-ui/multiselect/index上尝试了 2 种方式,例如 HTML 和 MVC

But it will display errors.但它会显示错误。 on MVC, added在 MVC 上,添加

  <script src="js/jquery.min.js"></script>
   <script src="js/kendo.all.min.js"></script>
  • Jquery version is 3.2.1 jQuery 版本是 3.2.1

According the error, elem seems like a jQuery object.根据错误, elem看起来像一个 jQuery 对象。

jQuery objects don't have a getClientRects method, only native DOM nodes does, so you probably want to extract the underlying DOM node first, using get() jQuery 对象没有getClientRects方法,只有本机 DOM 节点有,因此您可能希望首先使用get()提取底层 DOM 节点

elem.get(0).getClientRects()

You need the proper mix of jquery and jquery-ui .您需要jqueryjquery-ui的适当组合。

The combo required to use the new jquery version 3 is:使用新的 jquery 版本 3 所需的组合是:

https://code.jquery.com/ui/1.12.1/jquery-ui.min.js
https://code.jquery.com/jquery-migrate-3.0.0.js

Migrate is also needed.还需要迁移。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM