Reputation: 6240
I have the following code:
if (document.querySelectorAll('[id$=":maindiv:usernametext::content"]')[0].value == null || document.querySelectorAll('[id$="maindiv:usernametext::content"]')[0].value.trim() == "") {
console.log("maindiv:usernametext::content IS EMPTY !!!);
}
Inside of IE 8, this element always says the value is empty even though it is not. When running inside of a browser > IE 8 as well as Chrome and Firefox it works. Why does it return null every-time. I am running in IE 8 standards mode.
UPDATE
So I just console.log(document.querySelectorAll('[id$=":maindiv:usernametext::content"]')[0].value)
and it is returning the value, but this condition is not working? So it seems the selector is grabbing the value, but this if statement is executing when it shouldn't since there is a value? This field is just a text field.
Upvotes: 4
Views: 137
Reputation: 6240
Turns out trim is not supported by IE 8 and I removed it and it works!
Upvotes: 4