vivek vijayakumar vivek vijayakumar - 3 years ago 123
Javascript Question

block this special characters using query `~ #$^+|\ []{}<>

I want to block some special characters from entering in text box.
`~ #$^+|\ []{}<> these are the characters i would like to prevent from user inputting. Can any one suggest a solution or reg ex.

Answer Source

function some(){
var input = document.getElementById('one').value;
var one = input.replace(/[(\\^`~#\$\^\+\|\\\[\]{}<>)]/g,"");
 <input type="text" oninput="some()" id="one"  >

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download