Javascript:
function textonly(e) {
var code;
if (!e) var e = window.event;
if (e.keyCode) code = e.keyCode;
else if (e.which) code = e.which;
var character = String.fromCharCode(code);
var AllowRegex = /^[\ba-zA-Z\s-]$/;
if (AllowRegex.test(character)) return true;
return false;
}
Html:
<asp:TextBox ID="textbox1" onkeypress="return textonly(event);" runat="server"></asp:TextBox>
I am trying to allow only text.If i use textonly event in above js function,
i can not press key below:
ğ,ü,ş,i,ö,ç and Space
how can i also include above values on key press ?