Adding class in a <link> if no pathname is detected
<p>We want to add a class on our the first-child of the link when <strong>window.location.pathname</strong> is <strong>NULL</strong></p>

<p>the html code is</p>

<pre><code>  &lt;nav&gt;
    &lt;a href="index.php"&gt;Home&lt;/a&gt;
    &lt;a href="company.php"&gt;Company&lt;/a&gt;
    &lt;a href="products.php"&gt;Products&lt;/a&gt;
    &lt;a href="technical.php"&gt;Technical&lt;/a&gt;
    &lt;a href="services.php"&gt;Services&lt;/a&gt;
    &lt;a href="contactus.php"&gt;Contact Us&lt;/a&gt;
  &lt;/nav&gt;
</code></pre>

<p>and the URL is <em>www.nicadpower.com/</em> doing</p>

<pre><code>window.location.pathname.substring(1);
</code></pre>

<p>Would not result anything except a <strong>NULL</strong>.</p>

<p>After detecting a NULL we want the <strong>$('nav a')</strong> first-child to add the <strong>class="current"</strong></p>

<pre><code>  &lt;nav&gt;
    &lt;a href="index.php" class="current"&gt;Home&lt;/a&gt;
    &lt;a href="company.php"&gt;Company&lt;/a&gt;
    &lt;a href="products.php"&gt;Products&lt;/a&gt;
    &lt;a href="technical.php"&gt;Technical&lt;/a&gt;
    &lt;a href="services.php"&gt;Services&lt;/a&gt;
    &lt;a href="contactus.php"&gt;Contact Us&lt;/a&gt;
  &lt;/nav&gt;
</code></pre>
