title: Inserting jQuery with Drupal 7
body: <p>I want to use the Colourbox jQuery script on my Drupal 7 site, but I only want it to load on certain content types.</p>
  
  <p>I found [this script][1] that does want I want. It is for Drupal 6, but seems to work perfectly for Drupal 7.</p>
  
  <p>In the script, you have to insert the Java Script inside a PHP wrapper.
  However, because my Java Script uses two kinds of quotation marks/apostrophes it breaks the script. How can I correct this?</p>
  
  <p>Here is the script I am trying to use (inserted in template.php):</p>
  
  <blockquote>
    <p>function
    THEMENAME_preprocess_node(&amp;$variables)
    {
        // test for resource page node type   if ($variables['type'] ==
    'resources_page') {</p>
  
  <pre><code>// include colorbox javascript
  drupal_add_js(path_to_theme() . '/scripts/colorbox/jquery.colorbox.js');
  
  
  // include colorbox css
  drupal_add_css(path_to_theme() . '/scripts/colorbox/colorbox.css');  
     $js = '        jQuery(document).ready(function(){
        jQuery('.photos&gt;a').attr('rel',
  </code></pre>
    
    <p>'colorbox');
              jQuery("a[rel='colorbox']").each(function(){</p>
  
  <pre><code>jQuery(this).colorbox({title:jQuery(this).attr('title')+
  </code></pre>
    
    <p>" " + 
        jQuery(this).find('img').attr('alt')});
    }); 
        ';
        drupal_add_js($js, 'inline');
           }    }</p>
  </blockquote>
  
  <p>The bit <strong>jQuery("a[rel='colorbox']").</strong> breaks the script as it has two kinds of quotation marks. How can I fix this?</p>
  
  <p>[1]:   // Add jScript <a href="http://thedrupalblog.com/adding-jquery-image-carousel-your-node-view" rel="nofollow">http://thedrupalblog.com/adding-jquery-image-carousel-your-node-view</a></p>