Added jquery library, it works fine, but when i click on node edit, jquery does not work for this page. I need to style some inputs inside this edit page. I am using theme zen. For example i want to change color of edit-title

(function($) {

    $('#edit-title').css('color', 'red');


not working. Its loaded i see in firebug. But any code does not work(only inside edit or admin menus).

  • What do you mean by added jquery library. It is already included in the Drupal install. Did you want to update the library ?? if so the correct way of doing it is using drupal.org/project/jquery_update
    – junedkazi
    Oct 18, 2012 at 21:33
  • added script not library sorry Oct 18, 2012 at 21:47
  • Try using the jQuery over the $ syntax. In other words, jQuery(document).ready(function() { jQuery('#edit-title') and so on. Oct 18, 2012 at 21:49

1 Answer 1


In the firebug(any) console, try jQuery('#edit-title').css('color', 'red'); it should work or something with the css is wrong.

For Drupal you're really supposed to use something like this to do on document load:

(function ($) {
  Drupal.behaviors.exampleModule = {
    attach: function (context, settings) {
      $('.example', context).click(function () {

Check out Managing JavaScript in Drupal 7, and search for "behaviors".

@ krister.. The code is a function where the $ variable is jQuery. So in most languages you create function and declare variables that you want passed into it. Well in JavaScript you can create that in one line.

function some_function(tmpVar){ alert(tmpVar); }

You can wrap the function side in ()s and it still works
( some_function )("Woot!");

Now you can put an anonymous function block instead of some_function

( function(tmpVar){ alert(tmpVar); } )("Woot!");

and finally the jQuery

(function($){... the $ = jQuery ...})(jQuery);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.