Replace href hyperlink

Hi folks could you help…

How can I on load grab this links hyperlink and id store them as separate variables finally replace hyperlink.

Now create onclick event to add link value to that link on click…

<a href="https://www.site.com/friends/action/request/id/21616/" id="friendship838695">
                        Add to Friends
                    </a>

On page ready needs to be like this:

<a href="javascript://" id="friendship838695">
                        Add to Friends
                    </a>

OnClick add this restore url value: https://www.site.com/friends/action/request/id/21616/

Thanks

I’m thinking it would be better as a form element or a page button. i.e. the link isn’t really a “GET this page” it’s more a “POST this action”.