title: Uncaught TypeError: Cannot read property 'value' of null
body: <p>This my PHP code:</p>
  
  <pre><code>echo '&lt;td&gt;';
  $r= $item['Rate'];
  echo '&lt;input  id="ratetb" onkeyup="clean(ratetb)" onkeydown="clean(ratetb)" name="ratetb" autocomplete="off" style="text-align:center" type="text" value="'.$r.'" &gt;';          
  echo '&lt;/td&gt;';
  </code></pre>
  
  <p>and this is my JavaScript function:</p>
  
  <pre><code>function clean(e) {
      var textfield=document.getElementById(e);
  
      var replc=/[^0-9 .]/gi;
  
      textfield.value=textfield.value.replace(replc,"");
    }
  </code></pre>
  
  <p>when executes this i got error  </p>
  
  <blockquote>
    <p>Uncaught TypeError: Cannot read property 'value' of null  </p>
  </blockquote>