It's not a case of the alert not showing up. That would result in an
error halting all processing. So for a human sitting at the screen that
would give us the data he wanted. But for code that needs to do
something differently if jQuery were not loaded, the alert method would
just fail and
Of course it would fail if the function didnt exist.
Thats the point.
He wanted to know how to check if it was loaded or not, so If the alert
doesnt show up, its not loaded.
On Feb 6, 2008 11:48 PM, Shawn <[EMAIL PROTECTED]> wrote:
>
> That would fail if jQuery hasn't loaded. It would give an
That would fail if jQuery hasn't loaded. It would give an error saying
something like "$ has no properties", or "$ is not a function".
You could try something like this:
if (jQuery) { alert("jQuery loaded"); }
I haven't tested this but don't see why it wouldn't work...
HTH
Shawn
Kyle Brown
$(document).ready(function() {
alert('hi');
});
This uses jQuery's .ready function on the document object
On Feb 6, 2008 2:41 PM, MikeeBee <[EMAIL PROTECTED]> wrote:
>
> Is there a small piece of code you can put on a page to test if jquery
> has loaded?
>
> Thanks
>
On Feb 6, 2008, at 5:41 PM, MikeeBee wrote:
Is there a small piece of code you can put on a page to test if jquery
has loaded?
Thanks
Sure. You could do this:
if (typeof jQuery != 'undefined') {
// do something
}
--Karl
_
Karl Swedberg
www.englishrules.com
www.lear
5 matches
Mail list logo