0

This problem has bothered me for many hours now, and I hope somebody can help me.

I have the following code, which opens and closes a recursive UL menu. It works everywhere, except IE9. However, it only works when I refresh the page with CTRL+F5. If I don't refresh with CTRL+F5 I get a bunch of errors like the following:

  • SCRIPT5022: DOM Exeption: SYNTAX_ERR (12); (refering to if (currentLink))
  • SCRIPT5022: DOM Exeption: SYNTAX_ERR (12); (refering to currentLink.parent().find)

Does anybody know what's going on here?

    $('.groups').find('li:has(ul)').find('.uitklapTrigger').click(function(){
    var currentLink = $(this);
    if (currentLink.parent().find('ul').first().is(":hidden")){
        currentLink.children('.plmin').html('-');
        currentLink.parent().find('ul').first().slideDown('slow');
    } else {
        currentLink.parent().find('ul').first().slideUp("slow", function(){
            currentLink.children('.plmin').html('+');
        });
    }

    return false;
});
Hans
  • 528
  • 1
  • 8
  • 29
  • 1
    anyway for you to reproduce it in a [FIDDLE](http://jsfiddle.net/)? – wirey00 Jan 08 '13 at 22:37
  • I tried, but there's really too much code to strip.What happens on multiple pages of the site is that i get strange errors on simple jquery code that normally works ok. It only happens in (multiple) IE9 and I need a CTRL+F5 to make everything run ok again. For instance $(this).slideUp("slow", function(){ alert('test') }); only works after ctrl+f5, it only allows the animation without oncomplete callback. – Hans Jan 08 '13 at 22:44
  • the structure under .groups is too big? are there multiple of those elements? Can you just show one as an example? – wirey00 Jan 08 '13 at 22:46
  • Sounds like your code may be getting downloaded in the wrong order. Make sure everything's in the ``, wrap your code in `$(document).ready` and put `jquery.js` before anything else. – Blazemonger Jan 08 '13 at 22:46
  • @wirey There are multiple .groups items, but that can't be the problem because the problem also happens on other pages with a simple animation. – Hans Jan 08 '13 at 22:51
  • @Blazemonger The order is ok, first jquery, then local js, everything is in and inside $(document).ready(function(){ ... – Hans Jan 08 '13 at 22:52
  • It almost looks like the jquery variable $ cannot be used inside jquery Functions like .hover(function(){ except when i refresh with ctrl+f5 – Hans Jan 08 '13 at 23:02
  • Perhaps you are falling foul of [this problem](http://stackoverflow.com/a/7315790/1576269)? – Owlvark Jan 09 '13 at 00:58
  • @Owlvark Just checked, but all id's are valid. Anyhow, how can it all work after a refresh? – Hans Jan 09 '13 at 08:10

1 Answers1

0

The answer is clear. It had to do with some IE9 setting. Miraculously the pc's on which I tested both had some strange (acer factory default) browser settings. I had reset the browser settings and the problem was solved... Thanks everybody.

Hans
  • 528
  • 1
  • 8
  • 29