Home JavaScriptCore Javascript How to redirect to a URL using JavaScript ?

How to redirect to a URL using JavaScript ?

by admin
0 comment 157 views
How to redirect to a URL using JavaScript

It’s very easy to redirect to using window.location.href set this equal to url to which you want to redirect. I used the following function to redirect to a URL by getting the from DOM.

jQuery(document).ready(function(){
         var url = jQuery("#selector").attr('href');
         window.location.href = url ;
});

Leave a Comment

You may also like

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More

Privacy & Cookies Policy