$('select').on('change', function() { const has = this.options[this.selectedIndex].classList.contains('services-slide_one'); document.body.classList[ has ? 'add' : 'remove' ]('test'); });