Suppose it's in a.html.
How to change url to b.html with jQuery?
I assume you want to change the target (href) of a <a> element using jQuery?
$("a#your_id").attr("href", "b.html"); // where `a#your_id` is your selector
Or, you want to change the current location in the browser (redirect someone to another page)?
window.location = "b.html"; // No jQuery required for this!
if your question is how to change existing href=a.html to href=b.html, then this should work ..
$('a[href=a.html]').attr('href', 'b.html');
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With