Click here to Skip to main content
15,886,689 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Allow only these characters in textbox and restrict other characters from being inserted 

Allow only 
alphabets , numbers , left key, right key, backspace key, delete key, forward slash, round brackets (), ampersand, dot, dash, whitespaces 

other characters should be ignored.


What I have tried:

([A-Z])\w+

I have tried this but not getting successful.
Posted
Updated 10-May-18 12:34pm
Comments
Nathan Minier 10-May-18 11:41am    
That's a regex, which is great and all, but will not manage key press events on it's own. You need to supply your event handling logic before anyone will be able to assist.

$('.a').onkeydown(function(){
///
})
 
Share this answer
 
Comments
Richard Deeming 10-May-18 12:19pm    
If you want to update your question, click the green "Improve question" link and edit your question.

DO NOT post your edit as a "solution".
Patrice T 10-May-18 12:46pm    
Use Improve question to update your question.
So that everyone can pay attention to this information.
A regex is not a solution. It can identify if your entered text is inside the range, but it won't do anything about it
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900