[jQuery] Re: "$(document).ready(function() {" giving error "$ is not a function" - what am I doing wrong?

2008-05-09 Thread Richard D. Worth
On Fri, May 9, 2008 at 10:21 AM, Fred P <[EMAIL PROTECTED]> wrote:

>
> A little more specific:
>
> You're using jQuery.noConflict() which allows you to use the variable
> jQuery


Pardon me for being a little pedantic: jQuery.noConflict does not allow you
to use the variable jQuery. The jQuery variable is there either way. If not,
you couldn't call jQuery.noConflict() ;)

jQuery.noConflict allows you to use the $ alias for something other than
jQuery, by returning it to its previously defined value.

Another option should be mentioned (for completeness). If you have a bunch
of javascript/jQuery code that's already written to use the $, and you don't
want to search and replace the $ with jQuery, you can use the following
pattern to have the $ alias be jQuery inside a block with all your jQuery
code, after calling jQuery.noConflict:

(function($) {
  // Inside this block, $ is the jQuery object
  // not the other $
})(jQuery);

- Richard


[jQuery] Re: "$(document).ready(function() {" giving error "$ is not a function" - what am I doing wrong?

2008-05-09 Thread Fred P

A little more specific:

You're using jQuery.noConflict() which allows you to use the variable
jQuery
"
jQuery(document).ready( function() {
jQuery("#sliding_cart").css({ display: "none"});
});

"
then later in your doc, you're using $ which is the same thing, if
you're not using  jQuery.noConflict(). However, it's one or the other,
not both.

"
 $(document).ready(function() {

 $("a").click(function(){
 alert("Thanks for visiting!");
 });

});
"
If you're using Prototype.js or any other JS Library that may use $,
then you need noConflict. If you're sure you'll never use any other JS
Library, then drop the noConflict and use $ instead of jQuery variable
everywhere.
If you're using some plugins or third party script asking you to use
noConflict for any reason, then use jQuery instead of $ (like those
guys: 
http://blog.evaria.com/wp-content/themes/blogvaria/jquery/index-multi.php).

Fred


[jQuery] Re: "$(document).ready(function() {" giving error "$ is not a function" - what am I doing wrong?

2008-05-08 Thread Byron

You are using jQuery.noConflict() which unbinds the jquery object from
the $ namespace so jQuery('a') still works on your site just $('a')
does not
from a cursory glace i cant see any reason for using the noConflict
function, remove that and your code will work.

On May 9, 12:11 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
wrote:
> Test page here -http://www.justice.net.nz/static.html
>
> Jquery is definitely being loaded - I'm currently pulling it from
> jquery.com, and Firebug is showing that it has loaded.
>
> Any ideas? This is my first attempt at jquery and I'm falling at the
> first hurdle :<


[jQuery] Re: "$(document).ready(function() {" giving error "$ is not a function" - what am I doing wrong?

2008-05-08 Thread Ryura

cherry austin - good idea, but not quite :)

Kenthumphrey,
You've declared jQuery.noConflict(); . This reverts $ back to its
previous value, in this case undefined. Either remove
jQuery.noConflict() or replace $(document).read(function(){}); with
jQuery(document).ready(function($){});

On May 8, 8:11 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
wrote:
> Test page here -http://www.justice.net.nz/static.html
>
> Jquery is definitely being loaded - I'm currently pulling it from
> jquery.com, and Firebug is showing that it has loaded.
>
> Any ideas? This is my first attempt at jquery and I'm falling at the
> first hurdle :<


[jQuery] Re: "$(document).ready(function() {" giving error "$ is not a function" - what am I doing wrong?

2008-05-08 Thread Richard D. Worth
Line 135:

jQuery.noConflict();

This turns off the $ alias in case you're using jQuery with another library
that wants it. Simply use jQuery in place of each $. Or, if you don't need
it, remove the noConflict call.

- Richard

On Thu, May 8, 2008 at 8:11 PM, [EMAIL PROTECTED] <
[EMAIL PROTECTED]> wrote:

>
> Test page here - http://www.justice.net.nz/static.html
>
> Jquery is definitely being loaded - I'm currently pulling it from
> jquery.com, and Firebug is showing that it has loaded.
>
> Any ideas? This is my first attempt at jquery and I'm falling at the
> first hurdle :<
>


[jQuery] Re: "$(document).ready(function() {" giving error "$ is not a function" - what am I doing wrong?

2008-05-08 Thread [EMAIL PROTECTED]

Hi, Kent. I'm a beginner myself, so I'm replying to you in the hope
that one of this group's more-experienced gurus will pick up!

It looks to me like you've bunged jQuery in the middle of a bunch of
other javascript (some of which was actually meant to work with
jQuery; it won't do too well outside your "document.ready" function).

The jQuery call is equivalent to .onload in that it begins when the
DOM has fully loaded. You probably already read this:
http://docs.jquery.com/How_jQuery_Works#Launching_Code_on_Document_Ready

Why not try putting all of your javascript calls INSIDE the jQuery
function, and see what happens? And hope somebody better-qualified
than me replies to your post ;)

Cherry.

On May 9, 1:11 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
wrote:
> Test page here -http://www.justice.net.nz/static.html
>
> Jquery is definitely being loaded - I'm currently pulling it from
> jquery.com, and Firebug is showing that it has loaded.
>
> Any ideas? This is my first attempt at jquery and I'm falling at the
> first hurdle :<