jQuery attribute selector unrecognized expression error
<p>I'm using the following code to select the list item for current page from a navigation unordered list, but I keep getting an unrecognized expression error on <code>'a[href$="{server-relative URL}"]'</code></p>

<p>I've checked matching quotes/brackets that other questions mention, and the link will not contain characters beyond the usual <code>/ &amp; ? %</code> The code I'm using is:</p>

<pre><code>$(document).ready(function() {
    var pathname = window.location.pathname;
    var selector = "'a[href$=\"" + pathname + "\"]'";
    var listItem = $(selector).parent().parent();
    listItem.addClass('selected');
});
</code></pre>

<p>I'm using jQuery 1.8.2 (latest version). Thanks!</p>
