Error jquery-ui draggable Cannot read property 'msie'

倖福魔咒の 提交于 2019-12-03 18:01:32

问题


I got some troubles to make work jquery-ui draggable. I will share with you my solution, this is the best solution?

I just insert this to test before I start my real work.

<script src="http://code.jquery.com/jquery-latest.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.24/jquery-ui.min.js"></script>

and

  $('img').draggable();

Like here: http://jsbin.com/eqowet/2/

But I got a error:

Error: Uncaught TypeError: Cannot read property 'msie' of undefined.


回答1:


msie is the flag on the jQuery.browser property

jQuery.browser was deprecated since version 1.3 and was removed in jQuery 1.9.0

Since you're using the latest version of hosted jQuery, your library was auto-upgraded to 1.9.0 hence the error.

As you've already realized, reverting back to 1.8.3 (or earlier version) fixes the issue; the real solution, however, is to stop using jQuery.browser




回答2:


I try a lot of examples but all isn't working, just the same message, that I realized the version 1.8.24 isn't compatible with the last jQuery version. I have changed for it and voilà is working now.

<script src="http://code.jquery.com/jquery-1.8.3.min.js"></script>

Like here: http://jsbin.com/eqowet/3/




回答3:


You can use migrate.js to get compatibility

http://blog.jquery.com/2013/02/16/jquery-migrate-1-1-1-released/




回答4:


I got this error for an older version of jquery mobile. If you are using an old JQM, you need to update. If you are on Rails you can use the jqueryhttps://github.com/tscolari/jquery-mobile-rails

If you use the rails gem right now, be sure to get the 1.3 beta 1 to get this fix:

gem 'jquery_mobile_rails', "~> 1.3.b1"



回答5:


Got the same error with "sortable". So, make sure that all dependant scripts are included, also should be the right sequence.

jquery.min.js
jquery.ui.core.js
jquery.ui.sortable.min.js

For example to make it work on Joomla you may do like this:

$doc =& JFactory::getDocument();
$doc->addScript('/media/jui/js/jquery.min.js');
$doc->addScript('/media/jui/js/jquery.ui.core.js');
$doc->addScript('/media/jui/js/jquery.ui.sortable.min.js');


来源:https://stackoverflow.com/questions/14366322/error-jquery-ui-draggable-cannot-read-property-msie

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!