[jQuery] Add Class to matched href location Click to flag this post

[jQuery] Add Class to matched href location Click to flag this post


Im having trouble getting this to work, I feel like Im really close.
Does anyone have any idea?
var path = location.pathname.substring(1);
if (a[@href == path]) {
$('.nav ul#example li.addClass('active'));
}