 <p>It can be done without js</p> <p>consider following code for your situation</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-css lang-css prettyprint-override"><code>a:active { color: orange; }</code></pre> <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script type = "text/javascript" src = "https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"&gt;&lt;/script&gt; &lt;div class="list-group" id="generalView"&gt; &lt;a href="" id="today" class="list-group-item myClass" data-toggle="modal" data-target="#displayDiary"&gt; &lt;h4 class="list-group-item-heading"&gt;Today's Diary&lt;/h4&gt; &lt;/a&gt; &lt;a href="" class="list-group-item myClass"&gt; &lt;h4 class="list-group-item-heading"&gt;Last Week's Diaries&lt;/h4&gt; &lt;/a&gt; &lt;a href="" class="list-group-item myClass"&gt; &lt;h4 class="list-group-item-heading"&gt;Last Month's Diaries&lt;/h4&gt; &lt;/a&gt; &lt;/div&gt;</code></pre> </div> </div> </p>