Hide A Href link with Javascript
<p>I have the following HTML </p>

<pre><code>&lt;li class="navUser-item navUser-item--account"&gt;
     &lt;a class="navUser-action" href="/login.php"&gt;Login&lt;/a&gt; 
     &lt;span class="navUser-or"&gt;or&lt;/span&gt; // Hide this
     &lt;a class="navUser-action" href="/login.php?action=create_account"&gt;Sign Up&lt;/a&gt;  // Hide this
&lt;/li&gt;
</code></pre>

<p>I'm trying to hide the last ahref and the span tag using Javascript.  I can't seem to get this to work as expected, I have tried the following:</p>

<p>I was hoping I could extend this to look for a given Href and if its of such value i.e create account then hide it however no such luck. </p>

<pre><code>var litag = document.getElementsByClassName('navUser-item navUser-item--account'), i;

for (i = 0; i &lt; litag.length; i += 1) {

   litag[i].style.display = 'none';
}
</code></pre>

<p>I then tried the following: </p>

<pre><code>document.getElementsByClassName('navUser-item navUser-item--account a:nth-last-child(2)')[0].style.visibility = 'hidden';
</code></pre>

<p>tried finding the second a and yet didn't work, can someone shed some light into how I go about hiding the span and the last a href? </p>