Hello Why is this working: if (element.up().id == 'tab4') element.addClassName('active');
And this not: if (element.up().id == this.activeTabId) { element.addClassName('active'); And this.activeTabId = tab4 See here the full javascript code: var ActiveStyle = Class.create(); ActiveStyle.prototype = { initialize : function(element, activeTabId) { this.activeTabId = activeTabId; this.panelLinks = $('tabset').select('a'); Event.observe($(element), 'click', this.doConfirm .bindAsEventListener(this)); }, doConfirm : function(e) { this.panelLinks.each(function (element) { if (element.up().id == 'tab4') { element.addClassName('active'); }else { element.removeClassName('active'); } }) } }