Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Use jQuery to navigate away from page

I will only have a relative link available to me but I want to use jQuery to navigate to this rel link. I only see AJAX functionality in jQuery. How can I do this using jQuery or just pure HTML/JavaScript?

like image 524
Shaun Avatar asked Jul 30 '09 15:07

Shaun


People also ask

What does $() mean in jQuery?

In jQuery, the $ sign is just an alias to jQuery() , then an alias for a function. This page reports: Basic syntax is: $(selector).action() A dollar sign to define jQuery.

How do I navigate to another URL?

To navigate to a new URL, use the location object from the Browser's History API. The session history lets you reassign the location object to a new URL or use the href property on that same object. The syntax for this approach is: window.

How do I navigate to a specific div in HTML?

Anchor target to navigate within the same page. By prepending your href with # , you can target an HTML element with a specific id attribute. For example, <a href="#footer"> will navigate to the <div id="footer"> within the same HTML document. This type of href is often used to navigate back to the top of the page.


1 Answers

window.location.href = "/somewhere/else"; 
like image 135
NickFitz Avatar answered Oct 14 '22 16:10

NickFitz