Punched using .hasClass() , but as it turned out will not work:
.hasClass('active') - if it contains a class, the function will return true , otherwise it will return false. .toggleClass('active', ) - true - if a class is added, false - otherwise.
$(function () { $('a[href^="#"]').click(function() { $(this).toggleClass('active', $(this).hasClass('active')); return false; }); }); Question: how to make the addition of a class as short as possible to the link you clicked on and then delete from its class if you clicked on another link?