I\'m writing my own Drupal 7 module, and like to use JQuery in it.
$(\'#field\').toggle();
But I\'m getting this error:
TypeErr
"$ is not a function" is a very common error that you may face while working with jQuery. You can try any answers of given below:
(function($){
//your can write your code here with $ prefix
})(jQuery);
OR
jQuery(document).ready(function($){
//Write your code here
});
Basically this will allow our code to run and use the $ shortcut for JQuery.