?
Solved

Javascript validation that will stop a ' (apostrophe) being entered

Posted on 2005-03-01
3
Medium Priority
?
434 Views
Last Modified: 2008-02-01
I'm looking for Javascript validation that will stop a ' (apostrophe) being entered into a HTML textbox form field.

Anyone have this?

Thanks

Picco
0
Comment
Question by:crmpicco
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 31

Expert Comment

by:GwynforWeb
ID: 13431712
<input onkeyup="this.value=this.value.replace(/'/g,'')" onblur="this.onkeyup()">
0
 
LVL 31

Accepted Solution

by:
GwynforWeb earned 200 total points
ID: 13431768
better

<input onkeyup="if (/'/.test(this.value)){this.value=this.value.replace(/'/g,'')}" onblur="this.onkeyup()">
0
 

Author Comment

by:crmpicco
ID: 13437340
much appreciated - many thanks
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In my daily work (mainly using ASP.net), I need to write a lot of JavaScript code. One of the most repetitive tasks I do are the jQuery Ajax calls. You know: (CODE) I don't know if for you it's the same, but for me is soooo tedious to write the …
Having worked on larger scale sites, we found out that you are bound to look at more scalable solutions to integrating widgets, code snippets or complete applications and mesh them into functional sites, in any given composition. To share some of…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question