Pop-up is showing when i clear the text area . Want to show only for numbers

I am checking the form validation where the text area can’t contain any numbers. But when I delete any text from the text area(when it is empty) the pop-up is showing again. I want to show the pop-up only for numbers.

function validate() {
  var re = /^[A-Za-z]+$/;
  if (re.test(document.getElementById('student_name').value)) {
    return true;
  } else {
    alert('Numbers are not allowed.');
  }
  var element = document.getElementById('student_name');
  element.value = element.value.replace(/[^a-zA-Z]+/, "");
}
<body>
  <form action="" method="POST">
    <tr>
      <td width="40%" colspan="2">Name of the student<br>

      </td>
      <td width="60%" colspan="2">
        <p align="left"><input type="text" name="Student_Name" size="20" autocomplete="off" id="student_name" oninput="validate()">
        </p>
      </td>
    </tr>
  </form>
</body>

Answer

Something like this will work? I’m sure there’s a better option, though.

function validate() {
  var re = /^[A-Za-z]+$/;
  if (re.test(document.getElementById('student_name').value) || document.getElementById('student_name').value === "" ) {
    return true;
  } else {
    alert('Numbers are not allowed.');
  }
  var element = document.getElementById('student_name');
  element.value = element.value.replace(/[^a-zA-Z]+/, "");
}
<body>
  <form action="" method="POST">
    <tr>
      <td width="40%" colspan="2">Name of the student<br>

      </td>
      <td width="60%" colspan="2">
        <p align="left"><input type="text" name="Student_Name" size="20" autocomplete="off" id="student_name" oninput="validate()">
        </p>
      </td>
    </tr>
  </form>
</body>