Cannot trim whitespace on email input
<p>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.</p>

<p>EDIT:</p>

<p>It is a Ruby on Rails application but the HTML created is like so:</p>

<p>View:</p>

<pre><code>&lt;input class="mandatory form-control form-control" id="user_email" maxlength="250" name="user[email]" required="required" type="email"&gt;
&lt;input class="mandatory form-control form-control" id="user_password" maxlength="20" name="user[password]" required="required" type="password"&gt;
</code></pre>

<p>JQuery:</p>

<pre><code>$('input').blur(function()
{
    this.value=$(this).val().trim();
});
</code></pre>

<p>I have also tried this but still no luck. It strips whitespace between text but still wont remove trailing whitespaces:</p>

<pre><code>$('input[type=email]').on('blur', function () 
{
    $(this).val($(this).val().replace(/ /g,''));
})
</code></pre>