toxicious Posted May 1, 2012 Report Share Posted May 1, 2012 This piece of code is driving me nuts: function loadBtn(){var theBtn = document.getElementById("gaddonsBtn"); //Add the checkbox if (element != null) { element.innerHTML += '<br /><input type="checkbox" id="autoPick" value="autoPick" style="margin-top: 8px;" /> Auto-pick best mirror'; } var checkbox = document.getElementById("autoPick"); //Add the save event if (checkbox != null) { document.getElementById("autoPick").addEventListener("click", saveAutoPick, false); } theBtn.addEventListener("click", navigate, false);} The problem is that when I click "theBtn" nothing happens. But if I remove all the checkbox code (all code except the first and last line) the button do work.There is something wrong with that checkbox code. The checkbox gets added, I can view it, and its click event works too. The only thing that doesn't work here is the damn button. It would be great if someone could help me on what's wrong here! Link to comment Share on other sites More sharing options...
justsomeguy Posted May 1, 2012 Report Share Posted May 1, 2012 Have you verified that it is calling the navigate function when you click on the button? Are you checking for Javascript error messages? Link to comment Share on other sites More sharing options...
toxicious Posted May 1, 2012 Author Report Share Posted May 1, 2012 Have you verified that it is calling the navigate function when you click on the button? Are you checking for Javascript error messages? Yes, I have an alert on the click event. If I remove the checkboxes code (as I said) that alert goes off.Where should I check for the errors? Link to comment Share on other sites More sharing options...
justsomeguy Posted May 1, 2012 Report Share Posted May 1, 2012 Your browser has a developer console, check the links in my signature for the various debuggers in browsers. Link to comment Share on other sites More sharing options...
yisera Posted May 1, 2012 Report Share Posted May 1, 2012 Try getting firebug from here and start debugging from there. Link to comment Share on other sites More sharing options...
toxicious Posted May 1, 2012 Author Report Share Posted May 1, 2012 Firebug stopped working with the latest Aurora, so I'll just wait until they update it before I do any more debugging I think. Link to comment Share on other sites More sharing options...
thescientist Posted May 2, 2012 Report Share Posted May 2, 2012 even without Firebug it still has error console. or just use Chrome/Safari. They both have a full suite of developer tools built in. Link to comment Share on other sites More sharing options...
toxicious Posted May 2, 2012 Author Report Share Posted May 2, 2012 Oh found it now. Nope, not getting any errors/warnings related to my code 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