I am getting this error when the imageassist javascript loads:
Uncaught TypeError: Property '$' of object [object DOMWindow] is not a function

The javascript console is giving me the following info:

Uncaught TypeError: Property '$' of object [object DOMWindow] is not a function
Drupal.behaviors.img_assistimg_assist.js:4
(anonymous function)drupal.js:42
D.extend.each:1
Drupal.attachBehaviorsdrupal.js:41
Drupal.theme.placeholderdrupal.js:277
D.fn.extend.ready:1
D.extend.ready.D.readyList:1
D.extend.each:1
D.extend.ready

Any ideas what might cause this?

Comments

sun’s picture

Status: Active » Closed (cannot reproduce)

This means that jQuery is loaded after Image Assist, which should not happen.

nicholasThompson’s picture

I'm getting this same error with a custom script in my theme...

Drupal.behaviors.expandcode = { 
  attach: function(context) {
    $('div.findme', context).each(function() {
      // Run me...
    }); 
  }
};
nicholasThompson’s picture

So - turns out JQuery in Drupal 7 has changed to allow for other libraries to function without conflicts. See: http://drupal.org/node/756722

philosurfer’s picture

Issue tags: +jQuery, +drupal 7

It would have been nice to know this sooner!!!

I was having to use "jQuery()" instead of "$()"
and going nuts because of it.... ;-P

for those of you that did not read past this thread onto the link...
to use jQuery in D7 you need to wrap your code in this:

(function ($) {
  // All your code here
})(jQuery);
samerali’s picture

Thanks philosurfer this hepled me as well and saved me alot of time.

jnthnmyrs’s picture

Wonderful! Thank you nicholasThompson and philosurfer! I am no longer confused. :)

philosurfer’s picture

Seeing as this is an old thread....

I highly recommend reading this for understanding JavaScript and Drupal. Drupal. behaviors is very powerful

http://drupal.org/node/756722

lokinder.chauhan’s picture

Thanks man you saved me

hilrap’s picture

Issue summary: View changes

How would you wrap

$(".more-block").each(function () {

            if ....

?

phuocdv’s picture

Thanks
Comment #4philosurfer .

Bob_robinson’s picture

instead of $ , u need to use another symbol to prevent confliction between $ and Other $ signs

use this code: var jq = jQuery.noConflict(true);