title: How can i disable/remove white spaces only at the beginning of text inside an input field when someone paste text using javascript or jquery?
body: <p>I have an input field and i am using the following code to prevent users of adding white spaces only at the beginning of the text. How can i make it also so if someone copy and paste text that has white spaces at the first place of the text in the input to remove those spaces?</p>
  
  <p>Here's my code:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>$('.locField').on('keydown', function(e) {
    if (e.which === 32 &amp;&amp;  e.target.selectionStart === 0) {
    return false;
    }  
  });</code></pre>
  <pre class="snippet-code-css lang-css prettyprint-override"><code>.myform { 
  background:#eee;
  padding:15px;
  width:100%;
  }
  .locField {
  width:80%;
  padding:12px;
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"&gt;&lt;/script&gt;
  &lt;div class="myform"&gt;&lt;input placeholder="Try to add a space at the beggining..." type="text" class="locField"/&gt; &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>PS: To make my question more clear, please do not suggest me to use the ".trim" function as i want to remove the white spaces ONLY at the beginning of the text. </p>