Click here to Skip to main content
15,867,686 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i need to allow the user to enter an apostrophe sign wen he enter his/her name i have used the following code in javascript

JavaScript
if (!form1.txtfname.value.match(/^[a-zA-Z]+$/)) {
                document.getElementById('<%= lblfnamejs.ClientID%>').innerText = "Enter a valid name";
                return false;
Posted
Updated 13-Nov-11 23:41pm
v2

1 solution

Include apostrophe in expression as ^[a-zA-Z']+$
 
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