Try the following:
<!DOCTYPE html>
<html>
<head>
<script src="http://code.jquery.com/jquery-latest.js"></script>
</head>
<body>
<ul id="sidebar">
<li><a href="https://stackoverflow.com/one">One</a></li>
<li><a href="http://stackoverflow.com/two">Two</a></li>
<li><a href="http://stackoverflow.com/three">Three</a></li>
</ul>
<script>
var pathname = window.location.pathname;
//$("a:contains('One')").css("color", "red"); // This will make One red (notice capital O)
$("a:contains(pathname)").css("color", "red");
</script>
solved Target a link if that link links to the current page?