location.pathname
<p>I want to add a class to a menuepoint if one path is selected.</p>

<p>It would be easy if every site was its own <code>.php</code>/<code>.html</code> file, however everything is ruled in <strong>one</strong> <code>.php</code> file and everything is navigated over actions (<code>?action=main</code>, <code>?action=userinformation</code>).</p>

<p>I am searching for an alternative to get this work with the path <strong>and</strong> the action.</p>

<pre><code>if (location.pathname == "/index.php") {
    $("#main1").addClass("mainActive");
} else if (location.pathname == "/index.php?action=other") {
    $("#main2").addClass("mainActive");
} 
</code></pre>
