Here is the code:
html:
<div class="toggle">
<a href="#" class="active">5</a>
<a href="#" class="">10</a>
<a href="#" class="">25</a>
<a href="#" class="">50</a>
</div>
<span class="result"></span>
js:
$('.toggle a').click(function(){
$('.toggle a').removeClass('active');
$(this).closest('a').addClass('active');
$('.result').html('???');
});
css:
.active {
color: red;}
How can i show when I press ‘a’ it will show current ‘a’s number.
$(this).text()will get you the contents of the tag that triggered the click.