I add javascript successfully in Drupal 7 with jQuery in Bartik / Antonelli (cf How to add Javascript in Drupal 7 with jQuery)

(creating node--article.tpl.php from node.tpl.php with

<script type="text/javascript">
    (function($) {
            return false;

and then creating new article with :

<style type="text/css">
  p.toggler:hover {

<p class="toggler" style="cursor:pointer;">Show/Hide the following paragraph(s).</p>
    This paragraphe is initially hidden. Clicking on the link above will reveal (Show) all the content inside the DIV that immediately follows a "toggler" class paragraph.


and it works;

I tried it with Corolla 7.x-3.0-rc1 creating also node--article.tpl.php in Corolla / templates and trying to move the code at different places in the file, without success


VM’s picture

I suggest reading the comments on the link you provided which discusses using drupal behaviors rather than throwing javascript in a tpl.php file.

I'd also read through Managing JavaScript in Drupal 7