title: Deleting a negative value from number input and validation
body: <p>I feel that this is a dumb question, sorry.</p>
  <p>I have an input with the <code>number</code> type and I want to add some validation to it. It is not required, so an empty string should be valid, negative numbers too, but not the <code>-</code> sign.</p>
  <p>Consider now I've entered <code>-102</code> into that field and removing symbols one by one, watching for changes.</p>
  <p>Here's the basic <a href="https://codepen.io/k-one-o-two/pen/WNdwbWJ" rel="nofollow noreferrer">codepen</a> for it. As you can see, when there's just a <code>-</code> sign left the value (<code>event.target.value</code>) is an smpty string, which should be valid.</p>
  <p>So, how can I check if there is only a minus sign left and mark this field as invalid?</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>const el = document.getElementById('input');
  
  el.addEventListener('keyup', (e) =&gt; {
    const value = e.target.value;
    console.log(value)
  })</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;input type="number" id="input"&gt;</code></pre>
  </div>
  </div>
  </p>