Code breaks without an alert() !!!

Code breaks without an alert() !!!

This one is throwing me. I have a small piece of code that I am using to call a function in dynamic drive's accordion menu script. As long as I leave the alert() line in, it works. Comment it out and the call to expandone() doesn't go through.

I must be missing something obvious, no? Here's the relevant part of the code (it is fired from $(document).ready() ):

$('.level0').each(function(index){
   if ($(this).attr('id') == lev0) {
      subMenuIndex = index;
   }
});
alert('smi: '+subMenuIndex);
ddaccordion.expandone('level0',subMenuIndex);


I can also move the alert around - put it inside the .each() or even in ddaccordion.expandone()]! As long as an alert fires somewhere in the process ddaccordion.expandone() does it's job. No alert, no expansion!

the actual test site is here:
http://www.spacialdynamics.com/englishTEST/whatIsSpacialDymanics.shtml

The code above expands the appropriate submenu as the page loads.

Help!!!
    • Topic Participants

    • kevin