How to Change the href Value of an <A> Tag After the Link Click using jQuery?

How to change the href value of an <a> tag after the link click using jQuery:

$(document).on('click', 'a', function(e) {

  // Simulate a link click to a new URL.
  window.location.href = "";

Every time an <a> tag is clicked jQuery will simulate changing the href value after the link has been clicked. Technically, it’s not actually changing the href value. Instead, jQuery is changing the final destination of the end-result of clicking the link — it updates the href value to point to the URL of the new website where the person who clicked the link should be sent. So, it’s the same result as changing the href value of the <a> tag, but a different approach to achieve it.

Fore more javascript web page redirect solutions and an in-dept discussion on the topic refer to StackOverflow Question 503093 “How Do I Redirect to Another Webpage?

Category: Website Development