pieter771 pieter771 - 3 months ago 17x
Javascript Question

Execute javascript function after page refresh

So I have a javascript function that shows the register form after the onclick but it doesn't refresh because it is on the same page. It just loads another form in. But when I have the Reset Password page and I want a button that goes directly to the register form instead of the standard login form and that you have to click manually on the register button.

How can I fix that after the click on the a href the page refreshes and that it will use the javascript code so it will show the register form instead of the login form.

// Switches the forms
height: "toggle",
'padding-top': 'toggle',
'padding-bottom': 'toggle',
opacity: "toggle"
}, "slow");
$('.toggle').html($('.toggle').html() == 'Register' ? 'Login' : 'Register');

The a href:

<a class="register-pass-reset" href="{{ url('/login') }}">


You'll want to link to url('/login#register'), then detect the hash in the JS when the page loads:

window.onload = function(){
    if(window.location.hash && window.location.hash == "#register") {
        //Change Login To Register Form