如何用jQuery更改url?

omg*_*omg 2 url jquery

假设它在a.html中.

如何使用jQuery将url更改为b.html?

Isa*_*ler 7

我假设你想使用jQuery 更改元素的target(href)<a>

$("a#your_id").attr("href", "b.html"); // where `a#your_id` is your selector
Run Code Online (Sandbox Code Playgroud)

或者,您想要更改浏览器中的当前位置(将某人重定向到另一页)?

window.location = "b.html"; // No jQuery required for this!
Run Code Online (Sandbox Code Playgroud)