开发者

"'data(...).options' is null or not an object" in jquery-ui

I'm using jquery-ui 1.8, and getting this error in Internet Explorer:

Webpage error details

User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; .NET4.0E)
Timestamp: Mon, 10 May 2010 06:26:48 UTC


Message: 'data(...).options' is nu开发者_C百科ll or not an object
Line: 75
Char: 13074
Code: 0
URI: http://localhost:58365/Scripts/Lib/jquery-ui-1.8.custom.min.js

Is this a known bug? Is there a workaround? The error happens when I use droppable/draggable.


Try couple of things:

If you tried the ready handler but still got this error, try the load even instead:

$(window).load(function(){
  // your code here
});

Or try putting your jquery/js code at the end of the page.


In jquery.min.js replace:

stop: function(event, ui) {
    var o = $(this).data('draggable').options;
    if (o._cursor) $('body').css("cursor", o._cursor);
}

With:

stop: function(event, ui) {
    if ($(this).data('draggable')) {
        var o = $(this).data('draggable').options;
        if (o._cursor) $('body').css("cursor", o._cursor);
    }
}


Check this question. I had something similar, because in our drop-function, we did ui.draggable.remove(). This meant jQuery had nothing to work on anymore.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜