Adding jQuery to a view (exposed filter: search terms) I'd like to add some jQuery (for search highlighting) to my Drupal 7 Views with exposed search terms filter. The point is that when a user clicks a search terms (or terms) the jQuery then highlights those words they searched for in the returned results.

I created the following preprocess function in my template.php file:

    // add jquery.highlight-5.js just to the search views page
    function themename_preprocess_node(&amp;$variables) {
      if(arg(0) == 'node' &amp;&amp; arg(1) == '8' &amp;&amp; arg(3) == null) {
        drupal_add_js(drupal_get_path('theme', 'themename') . 
'/js/jquery.highlight-5.js');
      }
    }


But as I put this together I realize I don't know what to put in arg(1) for my Drupal View. Anyone know how to find out the 'nodeid' of the Drupal View?
Use hook views pre render instead.

function themename_views_pre_render(&amp;$view) {

   if ($view-&gt;name == 'view_name' &amp;&amp; $view-&gt;current_display == 'block_1') {
    drupal_add_js(drupal_get_path('theme', 'themename') . '/js/jquery.highlight-5.js');
   } 
}



replace themename with your theme name
replace view_name with your view name
replace block_1 with your machine name