[jQuery] Re: Test if jquery has loaded

2008-02-08 Thread Shawn

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 the alternate code would never fire.

Of course, it comes down to what the coder really wants.  He/she now has 
two options.

Shawn

Kyle Browning wrote:
 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] 
 mailto:[EMAIL PROTECTED] wrote:
 
 
 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 Browning wrote:
   $(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]
 mailto:[EMAIL PROTECTED]
   mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote:
  
  
   Is there a small piece of code you can put on a page to test
 if jquery
   has loaded?
  
   Thanks
  
  
 
 


[jQuery] Re: Test if jquery has loaded

2008-02-07 Thread Shawn

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 Browning wrote:
 $(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] 
 mailto:[EMAIL PROTECTED] wrote:
 
 
 Is there a small piece of code you can put on a page to test if jquery
 has loaded?
 
 Thanks
 
 


[jQuery] Re: Test if jquery has loaded

2008-02-07 Thread Kyle Browning
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 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 Browning wrote:
  $(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]
  mailto:[EMAIL PROTECTED] wrote:
 
 
  Is there a small piece of code you can put on a page to test if
 jquery
  has loaded?
 
  Thanks
 
 



[jQuery] Re: Test if jquery has loaded

2008-02-06 Thread Karl Swedberg

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.learningjquery.com





[jQuery] Re: Test if jquery has loaded

2008-02-06 Thread Kyle Browning
$(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