title: limit imput length to max 10 chars
body: <p>I try to limit a form of input to 10 chars</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>var max_chars = 10;
  
  $('input#ctl00$bc$custom_element_44').keydown( function(e){
      if ($(this).val().length &gt;= max_chars) { 
          $(this).val($(this).val().substr(0, max_chars));
      }
  });
  
  $('input#ctl00$bc$custom_element_44').keyup( function(e){
      if ($(this).val().length &gt;= max_chars) { 
          $(this).val($(this).val().substr(0, max_chars));
      }
  });</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"&gt;&lt;/script&gt;
  &lt;input name="ctl00$bc$custom_element_44" type="text" id="ctl00_bc_custom_element_44"&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>But it does not seem to work, advice is sought;)</p>
  
  <p>Regards Pete</p>