Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 436
  • Last Modified:

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

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
crmpicco
Asked:
crmpicco
  • 2
1 Solution
 
GwynforWebCommented:
<input onkeyup="this.value=this.value.replace(/'/g,'')" onblur="this.onkeyup()">
0
 
GwynforWebCommented:
better

<input onkeyup="if (/'/.test(this.value)){this.value=this.value.replace(/'/g,'')}" onblur="this.onkeyup()">
0
 
crmpiccoAuthor Commented:
much appreciated - many thanks
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now