Try this:
$("input[type=textbox]").keydown(function(){
if(/^[a-zA-Z0-9- ]*$/.test($(this).val()) == false) {
alert('Your search string contains illegal characters.');
}
if(/\s/g.test($(this).val()) {
alert("has white-space");
}
if(!$(this).val().length >= 8 && !$(this).val().length <= 25) {
alert("out of range");
}
});
For the fourth one you need to do it yourself because I don’t have access to your field names etc.
0
solved Validate username as the user types with jQuery and ASP.NET [closed]