Q:

Javascript + jQuery, click handler returning false to stop browser from following link

I'm trying to stop the browser from following certain links, rather I want to unhide some Divs when they are clicked.
I'm having trouble just getting the links to not be followed though. 
Here's what I have:
var titles = $('a.highlight');
jquery.each(titles, function(){
    this.click(function(){
        return false;
    });
});

It seems like the click handler is not being assigned. What am I missing?

A:

Try
this.click(function(e){ e.preventDefault(); }

Actually, it looks like you might need to use the jQuery constructor on this:
$(this).click(function(){ return false; }

You could also try using parameters on the each function instead of using this:
jQuery.each( titles, function(index, elem) { $(elem).click( function() { return false; } ) } );

Personally, I would just do titles.each( ... though.  In that instance you can use this to bind the click handler.  I am not sure off the top of my head what this binds to with jQuery.each
Or just calling click on titles:
titles.click( function() { return false; } )

That will bind click to every element in titles.  You don't need to loop through them.

