$('nav').on('click', 'a', function () { var $this = $(this) $this.addClass('active').siblings().removeClass('active') })