I want a user to add minimum 10 characters into the html text
. So for that I have set a validation on onblur
of the textbox. Below is the html and its JS code
HTML
<input type="text" class="form-control" id="txtStoreSiteAsstMangrMob" maxlength="10" onblur="checkLength(this)" onkeypress="return IsNumeric4(event);" ondrop="return false;" onpaste="return false;" />
JavaScript
function checkLength(el) {
if (el.value.length != 10) {
alert("Minimum 10 numbers are accepted");
} }
The problem here is that the validation is firing properly but the message is showing repetitively, even after clicking OK also.
So why is it happening like this?