JQuery script not working despite even though it works in the console

I am attempting to make the entire div of a Nivo slider on this site clickable so the visitor can navigate to a featured article. I developed the following script within Chrome’s console to work out the bugs.

var $  j = jQuery.noConflict();

$  j(function(){
    $  j( '.nivo-slice' ).click(function(){
        window.location = $  j('.nivo-html-caption').find('a:first').attr('href');
    });
});

This script works perfectly when entered via the console, however when inserted into a js file (custom.js) and included in the footer, it doesn’t work at all. If you view the page source, the file shows up correctly in the markup and Chrome’s inspector flags no errors. I’m confused, anyone have ideas?

Thanks!

newest questions tagged jquery – Stack Overflow

About Admin