Long time lurker of stackoverflow and just trying something with iframes and jquery which I couldn’t figure out an answer for.
I have jquery location in the main page but not inside the frame, in my iframe I have the usual $(document) jquery.
Unfortunately I get this error in firebug “$ is not defined”
Is there a way to get around this without calling jquery in each iframe?
Each frame has a separate Javascript environment with a different global scope. (Although they can access other frames using the
parentandframesproperties.Therefore, you need to include jQuery and other script files in the page inside each frame. (Including all plugins used by the frame)
If you really want to, you could write
top.$('selector', document)inside a frame, but I wouldn’t recommend it.