Toster
Toster

Reputation: 381

Firefox does not accept e-mail whith blank space on end

I would like to make my website work identically on every browser. Unfortunately, the validation mechanism introduced their differences.

Field of type 'e-mail' on Chrome and Opera 'trim';delete blank spaces on input of e-mail field and Firefox no cuts signs and do not accept e-mail in this form.

<input type="email" id="e-mail" class="" name="e-mail" value="" placeholder="" autocomplete="off">

Example:

enter image description here

Upvotes: 0

Views: 458

Answers (1)

Veve
Veve

Reputation: 6758

If you want to get the same behavior between browsers while keeping the email verification, you can trim the field on blur:

document.getElementById("e-mail").addEventListener("blur",function(e){
    this.value = this.value.trim();
});
<input type="email" id="e-mail" class="" name="e-mail" value="" placeholder="" autocomplete="off">

Upvotes: 2

Related Questions