title: Javascript append onblur.value mysql
body: <p>I trying to get the value of an <code>input type="text"</code> and with it, check if it really exists at my database and, if true, append it with an <code>input type="hidden" value="value-of-last-input"</code>, but my code isn't working.</p>
  
  <p>Here:</p>
  
  <pre class="lang-html prettyprint-override"><code>&lt;input type="text" class="form-control" id="codigo" name="codigo" onblur="RetirarProduto(this)" /&gt;
  </code></pre>
  
  <p>and JS:</p>
  
  <pre class="lang-js prettyprint-override"><code>function RetirarProduto(campo) {
      var codigo = campo.value;
      alert(codigo);
  });
  </code></pre>
  
  <p>I used <code>alert</code> to check the value, but it is not working.</p>