 <p>Your syntax are correct but there is some problem with CSS overriding you can use !important to you class attribute </p> <p>example :</p> <pre><code>&lt;script&gt; $(function(){ $(".breadcrumb a:first").addClass("itemhover"); }); &lt;/script&gt; .itemhover{ color : red !important; } </code></pre>