I used this documentation to split email verification and signup.
On the authentication page, I would like to trigger a click on the creation account link when the variable param = true (retrieved from another js file in localStorage).
the param variable has true value but the click does not triggered. The same code works in a simple html and js page.
JS code
if (localStorage.getItem('param') == 'true') {
alert(localStorage.getItem('param')); //true value but don't execute the click function
localStorage.setItem('param', false);
document.getElementById("createAccount").click();
}
How can I do it please.
Thanks @Jas Suri - MSFT for pointing OP in the right direction. Posting it as an answer to help other community members.
Include document.ready() method that is used to prevent other code from running till the document is completely loaded.
Please note that there is a chance that your jQuery code won't work if you don't use
document.ready()
So, to trigger a click on a create account link, make sure to run your code after calling document.ready() .
Check this link to know how to use document.ready() .