I was trying to trim trailing whitespace on an email input but believe there is an issue with trim being applied to email inputs. Can anyone explain why this is the case or whether I am incorrect in my assumptions. This code when applied works on the password field but not on the email field.
EDIT:
It is a Ruby on Rails application but the HTML created is like so:
View:
<input class="mandatory form-control form-control" id="user_email" maxlength="250" name="user[email]" required="required" type="email">
<input class="mandatory form-control form-control" id="user_password" maxlength="20" name="user[password]" required="required" type="password">
JQuery:
$('input').blur(function()
{
this.value=$(this).val().trim();
});
I have also tried this but still no luck. It strips whitespace between text but still wont remove trailing whitespaces:
$('input[type=email]').on('blur', function ()
{
$(this).val($(this).val().replace(/ /g,''));
})