Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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
Comment #1
sunThis means that jQuery is loaded after Image Assist, which should not happen.
Comment #2
nicholasThompsonI'm getting this same error with a custom script in my theme...
Comment #3
nicholasThompsonSo - turns out JQuery in Drupal 7 has changed to allow for other libraries to function without conflicts. See: http://drupal.org/node/756722
Comment #4
philosurfer CreditAttribution: philosurfer commentedIt 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:
Comment #5
samerali CreditAttribution: samerali commentedThanks philosurfer this hepled me as well and saved me alot of time.
Comment #6
jnthnmyrs CreditAttribution: jnthnmyrs commentedWonderful! Thank you nicholasThompson and philosurfer! I am no longer confused. :)
Comment #7
philosurfer CreditAttribution: philosurfer commentedSeeing 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
Comment #8
lokinder.chauhan CreditAttribution: lokinder.chauhan commentedThanks man you saved me
Comment #9
hilrap CreditAttribution: hilrap commentedHow would you wrap
?
Comment #10
phuocdv CreditAttribution: phuocdv commentedThanks
Comment #4philosurfer .
Comment #11
Bob_robinson CreditAttribution: Bob_robinson commentedinstead of $ , u need to use another symbol to prevent confliction between $ and Other $ signs
use this code: var jq = jQuery.noConflict(true);