I\'m writing my own Drupal 7 module, and like to use JQuery in it.
$(\'#field\').toggle();
But I\'m getting this error:
TypeErr
Chances are your script is not initialized this way, you'll have to use Drupal.behaviors.YOURTHEMENAME
(function ($) { Drupal.behaviors.YOURTHEMENAME = { attach: function(context, settings) { /*Add your js code here*/ alert('Code'); } }; })(jQuery);