I want a javascript validation on a textbox which can accept.
a. Characters
b. Characters with Numbers
It should not accept only numbers
For example i want something like:-
Abc123, A7 organisation.
but I dont want like;-
333333 , 2222222.
Also, special characters are also not allowed
I tried like below js function but it is not working
function NumersWithCharValidation() {
var textBoxvalue = document.getElementById('txtNameOfFirm').value;
alert(textBoxvalue);
if (textBoxvalue.match("/^(?![0-9]*$)[a-zA-Z0-9]+$/")) {
alert('Good to go');
}
else {
alert('Only Numbers are not allowed');
}
}
<input id="txtNameOfFirm" runat="server" onkeypress="return NumersWithCharValidation();" maxlength="200" type="text" width="65%" />
kindly suggest what is wrong