4 users online. Create an account or sign in to join them.Users
jQuery: "$ is not a function"
This is an open discussion with 5 replies, filed under Troubleshooting.
Search
jQuery uses $ by default, but because extension developers can include Prototype (and others) if they wish, jQuery is included using the “no conflict” method.
This means you need to use jQuery() rather than $().
To make this less painful and to use the $ syntax still, you can wrap your JS in a self-executing anonymous function, passing $ by reference:
See how Scott does it in admin.js. I use a similar method here:
http://github.com/nickdunn/uploadify/blob/cce714e14b62d16b36c773122b204ba6cf6746c4/assets/apply.js
Which is a Tabby bug ;-)
Ok, changing it to
setTimeout("jQuery.fn.tabby.pressed.last = null;",0);
helps. I wrote the developer of Tabby to change that in his official release (I hope jQuery.whatever() works even when “no conflict”-mode is disabled). Thanks for helping out.
I hope jQuery.whatever() works even when “no conflict”-mode is disabled
It will indeed. jQuery is the default function/class name, but it adds $ as a shorthand alias.
noConflict mode is very usewful but a lot of jQuery plugin developers forget people use it and they often reference a global $ which is very frustrating.
Create an account or sign in to comment.
While trying to use new, already included, jQuery-lib I am getting errormessages saying “$ is not a function”. Do I have to use a special variable for jQuery (I remember discussions about Prototype and jQuery both using $)?