tags:

views:

15

answers:

1

How do make sure that my $(document).ready( function() { ... } ) block executes?

A: 

You can leave this up to jQuery. They test their code thoroughly. If you just want to know if it executed, simply throw an alert or something in there.

thenduks
I did. And nothing happened. What are some ways to make sure that it will execute then. Firebug doesn't seem to reveal any errors.
syker
@syker: Try restarting Firefox. I've had instances in which the Firefox Javascript engine did not produce consistent results until I restarted it.
Adrian Grigore
Making sure it will execute is jQuery's job, once it's told to. If it doesn't execute, then it's not being set up -- that is, the code that'd set it up is not being executed. It'd be hard to help without seeing the code.
cHao
It's a lot of code but basically my one file includes another PHP file that also has a $(document).ready( function() { ... } ) block. I'm seeing an example of my friend's code where his two $(document).ready( function() { ... } ) blocks execute just fine. Is there a Javascript checker I can download for Firefox?
syker
Resolved my problem. I had too many unnecessary messages being logged to Firebug. Firebug did indeed log the error that I was experiencing.
syker