Changed the validation for a DOM object

Firefox didn't recognize my previous solution but this works properly :)