Why is my jQuery plugin calling Unable to read the length property of Undefined?

I feel bad asking one more question. I can’t read the length of the “length” of the Undefined question, but none of the answers online (SE or otherwise) has anything to do with my problem.

I tried my best to narrow down why this script error occurs for my situation, but I'm at a loss.

If I exclude this tag on the page, the error stops showing:

<script src="~/Plugins/jquery-ui-1.10.3.drag-drop.min.js" type="text/javascript"></script> 

All that is in the jquery-ui-1.10.3.drag-drop.min.js file is the jquery-custom file that I renamed, including jquery draggable, droppable and sortable.

I was sure that the error was caused by some script that I wrote, but as I just started checking this, I didn’t have much script to “comment on”, and when I did this, to my befuddlement, I didn’t get rid from an error. The only way I have found so far to get rid of the error is to completely eliminate the plugin, which I obviously would not be able to use if I did this.

Full error observed in the Chrome debugger:

 Uncaught TypeError: Cannot read property 'length' of undefined jquery-1.9.1.min.js:3 b.extend.each jquery-1.9.1.min.js:3 e.widget jquery-ui-1.10.3.drag-drop.min.js:6 (anonymous function) jquery-ui-1.10.3.drag-drop.min.js:6 (anonymous function) jquery-ui-1.10.3.drag-drop.min.js:6 

The problem is that (as is the case with most of these errors) that I can not determine the cause of the error, even if the code has not yet been written to use this plugin.

I am using jquery-1.9.1.min.js and jquery-migrate-1.2.1.min.js files.

True, I could ignore this error, since it really did not break anything, and the drag and drop, delete and sort functions seem to work just fine and as expected. I just think your page has script errors, and since I never tolerated them in the past, I really did not want to start tolerating them now.

Am I barking the wrong tree? Does the error indicate my drag and drop file? What can I do to reduce this error?

Please let me know if there is any additional information I can provide that will help.

AS REQUESTED- <script> , as they appear in the <head> :

 <script src="~/Resources/jquery-1.9.1.min.js" type="text/javascript"></script> <script src="~/Resources/jquery-migrate-1.2.1.min.js" type="text/javascript"></script> <script src="~/Plugins/jquery.maskedinput.min.js" type="text/javascript"></script> <script src="~/Plugins/jquery-ui.min.js" type="text/javascript"></script> <script src="~/Plugins/accounting.min.js" type="text/javascript"></script> <script src="~/Plugins/jquery.autoellipsis-1.0.10.min.js" type="text/javascript"></script> <script src="~/Plugins/jquery-ui-1.10.3.drag-drop.min.js" type="text/javascript"></script> <script src="~/Scripts/PluginConfigurations.js" type="text/javascript"></script> <script src="~/Scripts/main.js" type="text/javascript"></script> <script src="~/Scripts/EditPages.js" type="text/javascript"></script> 
+6
source share
2 answers

As @Pete helped you determine, this is really caused by duplication of your main jQuery UI scripts. Download them only once and your Undefined length problem will disappear.

+16
source

As @Pete helped you determine, this is really caused by duplication of your main jQuery UI scripts. Download them only once and your Undefined length problem will disappear.

Including the file below will double this problem.

jquery.ui.core.min.js

Make sure you turn it on only once.

0
source

Source: https://habr.com/ru/post/953488/


All Articles