Below code is validating properly.When i first submit the form,it shows the error message,second time when i submit,it is validating but not showing the error message.
function validate()
{
var textbox= $("#inputtextbox").val();
var match = /^([a-zA-Z0-9]{3,})$/;
if(!match.test(textbox)) {
$("#dataError").text('Maximum 3 alpha numeric characters and space allowed.').fadeOut(5000);
return false;
update
var textbox= $("#inputtextbox").val();
var match = /^([a-zA-Z0-9]{3,})$/;
if(!match.test(textbox)) {
$("#dataError").text('Maximum 3 alpha numeric characters and space allowed.').fadeOut(5000);
return false;
}
<form onsubmit="return validate()" >
<span id=""></span>
</form>
Thanks in advance!
Try this