Strange jQuery error in IE: Unexpected call to method or property access


Like allways, in Firefox, Chrome, Safari and Opera everything works without a problem. But IE... This is another story :)

Here is my full code: http://pastebin.com/ZdzzFayJ

At least one thing good in IE, come to me with the following error:

SCRIPT65535: Unexpected call to method or property access. 
jquery.min.js, line 3 character 29586

What is wrong? I can't find a bug :(


UPDATE

I cleaned up my code, javascript functions are now called as a jQuery plugin. I am still getting an error, but now I know where.

In my code I put a comment IE ERROR next to the code where IE alert the error message.

PLUGINS: http://pastebin.com/6Dnd1qtd

jQuery : http://pastebin.com/wiHALjZx

I have no idea why IE breaks there.. Any solutions?


Regards, Mario

For me the problem was the following:

i use a lib where is applied on all environment.

my_lib.js

jQuery.ajax({
        data : jQuery('form').serialize(),
        url : '/'+action[1]+'/post_form',
        type : 'POST',
        dataType: 'json',
        success: function(data){
            $('#my_name_id').find('option').remove().end().append(data.select_options);

});

Json returns:

select_options  "<option></option>"

Everything is fine! BUT, in one form #my_name_id is not a select, is a hidden field, it's a pre-selected value and disabled attribute for the user.

That's why jquery on IE8 retrieves me the error.

The solution was:

my_lib.js

jQuery.ajax({
        data : jQuery('form').serialize(),
        url : '/'+action[1]+'/post_form',
        type : 'POST',
        dataType: 'json',
        success: function(data){
          if( $('#my_name_id').is('select') ) {
             $('#my_name_id').find('option').remove().end().append(data.select_options);
          }
});

Hope it helps somebody!


You appear to be missing a semi-colon in your get_data function after echo_data(data).

request.done(function(data) {
    if (data) echo_data(data) _loading.hide();
    _ads_listing.unmask();
});

I solved the problem in the following way:

  • Clean up my code ( JSHint was very helpful! )
  • Before anything I included "//html5shiv.googlecode.com/svn/trunk/html5.js" to IE recognize that I am using HTML5 tags such as section, header,...
  • In jQuery plugin I fill element with html content. Instead of using $(defaultOpts.data_container).html("HTML CONTENT") I use defaultOpts.data_container.html("HTML CONTENT"). So I send object element $(#ID) in parameter to plugin instead of sending just element ID "#ID".

Now, everything working OK. Thank you all for your support and effort.