Shinori Posted October 25, 2017 Share Posted October 25, 2017 (edited) Harrow fellow campaigners, no idea what is going wrong here. Maybe anybody has a solution: Assume $logged_in being true.check_account_status() not firing. Also tried to change the attribute to onclick, onmousedown etc. The HTML (.php): <div id="wrapper-secondnav" class=""> <ul id="secondnav"> <li><a target="_blank" href="">Stuff</a></li> <li><a href="">Things</a></li> <li><a target="_blank" href="">Somestuff</a></li> <li><a href="">Anything</a></li> <?php if ($logged_in != true) { echo('<li><a id="register">Nooo</a></li>'); } else { echo('<li><a id="register" onload="check_account_status();">Yay</a></li>'); } ?> </ul> </div> And then there is the function in JS: function check_account_status() { alert("I like cookies"); } Thank you very much! Edited October 25, 2017 by Shinori Link to comment Share on other sites More sharing options...
justsomeguy Posted October 25, 2017 Share Posted October 25, 2017 Check your browser's developer console for Javascript error messages. I don't know if anchor elements even have a load event, but they might. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now