Your JS code is a function used to listen for events. It doesn't seem to have any effect on the page layout.
Since you didn't provide all the CSS code, it's possible that the invisible styles for alertpass and userpass, both of which use position: relative, are covering the 'Forgot Password?' link. You may need to adjust their positions.
The fastest way to verify whether these two styles are causing the issue is to temporarily change their position to absolute.