I have TextBox in which user can type only Alphabets(Lower&Upper), Hyphen (-), BackSpace only. These will be basically any Qualified URL name page like Contact/my-contact etc
I need Regex and restriction of keyboard keys on that Textbox.
For keyboard logic below code is not working properly as well so need help
jQuery('#UrlName').keypress(function (e) {
code = e.keyCode ? e.keyCode : e.which;
if ((code.toString() > 45 || code.toString() < 57) && (code.toString() < 97 || code.toString() > 122)) return false;
});