Adding jQuery Snippets

Two methods for inserting a jQuery snippet.

Method 1 - In the Views UI, navigate to Basic Settings > Header. In the Header, you can insert a jQuery snippet wrapped with <script> tags. This example sets links to open in a new window and provides advanced row striping for a table of data.

$(document).ready(function() { // override the anchor to open links in new window $('td.views-field-title a').click(function() {; return false; }); // colorize the rows with zebra striping and highlighting $('#tpp-listing-2').colorize(); });

Method 2 - using drupal_add_js()

Add new comment