Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Drupal 7 Adding Javascript and CSS file

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 255
    Comment on it
    • including both of them to.info file
    scripts[] = hello_world.js
    stylesheets[screen][] = hello_world.css
    
    • Adding a JavaScript file and a CSS file to a page
    $path = drupal_get_path('module', 'hello_world');
    drupal_add_js($path . '/hello_world.js');
    drupal_add_css($path . '/hello_world.css');
    
    • Adding inline JavaScript
     drupal_add_js('alert("Hello World!");', 'inline'); 
    • Adding inline CSS
     drupal_add_css("body { color: #ffffff; }", 'inline'); 

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: