-1

I am using Bootstrap, CSS, HTML, JavaScript/jQuery for designing my project. I have used some jQuery plugin in my project hence my button & <a> tag are not working. When I click on it doesn't redirect me to my webpage. How can I reactivate all <a> tag & button from a webpage using jQuery.

<a href="http://www.mahacareermitra.in/" target="_blank">Access the portal</a>
marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
  • 3
    Possible duplicate of [How to redirect to another webpage in JavaScript/jQuery?](https://stackoverflow.com/questions/503093/how-to-redirect-to-another-webpage-in-javascript-jquery) – Paolo Forgia Jun 27 '17 at 08:35

3 Answers3

3

It depends on what plugin you have activated: try disabling the one by one.

Probably one of them ( or your code ) is listening to the click event on the links and preventing the event.

Something like this:

$('a').on('click', function(e) {
   e.preventDefault();
   .... // more code
} )

In that case you should listen to more specific tags (like, using a class to identify them) and leave the general behaviour for link unaltered.

Carlo
  • 2,103
  • 21
  • 29
0

Simply use the window.location "href" property, or "replace" method:

// similar behavior as an HTTP redirect
window.location.replace("http://stackoverflow.com");

// similar behavior as clicking on a link
window.location.href = "http://stackoverflow.com";

See here reference

Giacomo Paita
  • 1,411
  • 2
  • 12
  • 21
0

One does not simply redirect using jQuery

jQuery is not necessary, and window.location.replace(...) will best simulate an HTTP redirect.

window.location.replace(...) is better than using window.location.href, because replace() does not keep the originating page in the session history, meaning the user won't get stuck in a never-ending back-button fiasco.

If you want to simulate someone clicking on a link, use location.href

If you want to simulate an HTTP redirect, use location.replace

For example:

// similar behavior as an HTTP redirect
window.location.replace("http://stackoverflow.com");

// similar behavior as clicking on a link
window.location.href = "http://stackoverflow.com";
R. Mani Selvam
  • 320
  • 8
  • 36
  • look at this link for reference :- https://stackoverflow.com/questions/503093/how-to-redirect-to-another-webpage-in-javascript-jquery hope you will get the answer..... – R. Mani Selvam Jun 27 '17 at 08:54