Number, please

<script type = 'text/javascript'> 
function emptyAlert(empty) { 
if (empty['myText'].value.length == 0) {
alert('Say something, please'); 
return false 
} 
}
</script>

 <form action="action.php" method="post" onsubmit="return emptyAlert(this)">
<input type="text" name="myText" >
<input type="submit">
</form>

If a user, with the code above, clicks the submit button without any text in the form, it says “Say something, please”.

I like to make it like the following.
If a user clicks the submit button with any text which is not pure numeric value, it says “number, please.”

If a user clicks the submit button without any text, it says “number, please.”

If a user clicks the submit button with “3cc45” in myText , it says "number, please.

If a user clicks the submit button with “abc” in myText , it says "number, please.

If a user clicks the submit button with “345” in myText , it goes to action.php.

Then change the condition to something else that checks for a number.

You can use !isNaN(Number(someString)) to perform such checks.