Trying to apply css to the first element in multiple divs with the same class. In the example below, it works in the first div, but not the second one. What's wrong with this picture?
<script>
$(document).ready(function(){
$(".axxs-tabs").each(function(){
$("ul li:first a").css("background-color", "yellow");
});
});
</script>
<div class="axxs-tabs">
<ul>
<li><a href="#">This is the first paragraph.</a></li>
<li><a href="#">This is the second paragraph.</a></li>
<li><a href="#">This is the last paragraph.</a>
</ul>
</div>
<div class="axxs-tabs">
<ul>
<li><a href="#">This is the first paragraph.</a></li>
<li><a href="#">This is the second paragraph.</a></li>
<li><a href="#">This is the last paragraph.</a>
</ul>
</div>
each
function is useless; you aren't using the result of that iteration. It's just going to repeat the inner code several times.this
within the function to use the result of theeach
.$(".axxs-tabs ul li:first-child a")