I have this:
<fieldset id="social_associations" class="">
<a href="/social/login/twitter">Associate your account to twitter</a>
<br>
<a href="/social/login/facebook">Associate your account to facebook</a>
<br>
</fieldset>
And I would like a function to follow the URLs within these links but these URLs are generated by a script and may change according to the user's profile (if a user has already associated an account then the URL that will appear will have 'disconnect' instead of 'login') so the function must take whatever appears in the link, it can't be hardcoded. I don't want to leave the current page while clicking on it. And when a link is clicked I would like to change the text from associate... to disconnect. Must be easy but I have no clue!
EDIT:
I understand that the question is not clear so I rephrased it here: javascript on click change href and open in new window