onblur is applied to an element that appears dynamically with php when click SOCIAL REGISTER where you return after some secs to this page… what the solution, include onblur js code inside php (html) block?
Both of these lines try to reference an element which doesn’t exist on load, so they are superfluous anyway.
If you dynamically add these elements according to how the user interacts with your page, you could always just check first to see if they exist first:
var email = document.getElementById("email");
if(email !=null){
email.onblur = checkUsername;
}
var unameLoading = document.getElementById("usernameLoading");
if (unameLoading !=null){
unameLoading.style.display = "none";
}
As i noticed these error non shown in chrome > when the php generates the code and this when press SOCIAL REGISTER > return to page itself (prior press to register(insert more data prior press required)) > page no errors…well?
I looked at the page you link to, but cannot see any JS errors.
I do see two 404 errors for a png anda gif file, but these won’t be affecting much.
I’m not too sure what you mean here, but the lack of errors are probably down to the fact that clicking on “SOCIAL REGISTER” inserts the missing elements (email and usernameLoading) into the page.
I’m not sure what you mean by eject and why you would want to remove this code.
The best advice I can give you now is to try and make a page where we can reproduce the error without having to click on this, do that, go back to the previous page etc.
I appreciate the fact that this must be frustrating, but it is the only way we are going to be able to bring this forward.
“I looked at the page you link to, but cannot see any JS errors.” press 1st or second blue div button to see embedded js errors…
when press 3rd blue div
" the missing elements (email and usernameLoading) into the page." but fixed problem with
with social register press=eject php no error,…
var email = document.getElementById(“email”);
if(email !=null){
email.onblur = checkUsername;
}
var unameLoading = document.getElementById(“usernameLoading”);
if (unameLoading !=null){
unameLoading.style.display = “none”;
}
I’m sorry, but I don’t really know what else I can tell you here.
The error is caused by the fact that you are trying to set the style property of an element that doesn’t exist in the DOM.
You can get around it like this:
var elementToTestFor = document.getElementById("elementID");
elementToTestFor should now either be the element or null, so:
if (elementToTestFor != null){
// Code here when the Element Exists.
}