jQuery addClass example

Change class name on click in jQuery

HTML

<a href="https://google.com">Go to Google</a>

JavaScript

$('a').on('click', function(e) {
  location.href = 'https://bing.com'
  e.preventDefault();
});