Checking if this textbox is a string

by Kirubel Girma

HTML

<input type="text" class="txt123" id="1a">

JavaScript

document.getElementById("1a").addEventListener("input", runcheck);

function runcheck() {
  var str = document.getElementById("1a").value
  if (str.match(/[A-Za-z]/i)) {document.getElementById("1a").value = str.slice(0, -1)}
}