Clicking a different link

Clicking a different link

Hello
I have a dotnetnuke site which we have recently upgraded to the latest version. I am trying to fix all the problems that have come about due to the upgrade. Unfortunately I know nothing of jquery. I hope someone can help point me at a solution. 

There is a login link at the top of the page with the following - it has a returnurl within it.



Later in the page I have a number of links which all need to go to the same login page but also need the same return url in the link. These links are generated in a template.

Someone has suggested some jquery to me to enable these links to essentially click the top login link. This is as follows:

<a href="#" class="CustomLoginLink OtherLinks" >login</a>


<script>
$(function(){ 
 $('.CustomLoginLink').click(function(){ 
 $('a[id$="loginLink"]').click(); 
 });
 });
</script>

When I click on the link it takes me to the top of the page, but doesn't click through on the original link
Can anyone help with what might me wrong ?

Thank you