Matching an anchor to an element.

Matching an anchor to an element.

This should be pretty simple one ,yet I can't seem to figure it out. There are posts that are similar to my question on here, but they don't really answer my questions.

The a user comes to the page, they're at a URL like such: http://www.xyz.com/foo1#abc.php

In the HTML, there is this code (a nav column):
<div id='testdiv'>
   <a href='foo1.php#abc' title='Some Stuff' >Listing Address</a>
   <a href='foo2.php#def' title='More Stuff'>Basic House Information</a>
   <a href='foo3.php#ghi' title='Yet More Stuff'>Property Information</a>
   <a href='foo4.php#jkl' title='No More Stuff'>Lot and Frontage</a>
</div>

I'd like to highlight the page they're on in the nav column with a ui-icon arrow. Notice there's a link on there that matches the page they're on.

Here's what I tried:

var anchor = window.location.hash.replace('#', '');
$('#testdiv').each(function() {
   $(this).has('anchor').addClass('test');
});

That didn't work.

Anyone have any suggestions?

Thanks!