Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"'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 null 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.

like image 619
ripper234 Avatar asked May 10 '10 06:05

ripper234


3 Answers

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.

like image 161
Sarfraz Avatar answered Oct 31 '22 09:10

Sarfraz


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);
    }
}
like image 20
Shaju KT Avatar answered Oct 31 '22 07:10

Shaju KT


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.

like image 1
Peter Avatar answered Oct 31 '22 07:10

Peter