I have an <a> for “Log in” as <a href="#" id="login">Log in</a>.
I’d like to replace the body of the <a> only when the url is on a certain page. How might you go about doing that with jQuery?
Clarification: When I’m at my /login URL, I want to change the <a> from:
<a href="/login">Log in</a>
to
<a href="/signup">Sign up</a>
I have the following jQuery but don’t know how to apply it to the specific link when the user is on a certain page.
$('a#login').html('<a href="/">Sign up</a>');
1 Answer