[jQuery] Add Class to matched href location

[jQuery] Add Class to matched href location


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'));
}