Restrict special characters being entered in textbox using javascript

How to restrict special characters.

Now let's have a look over how to call this special characters restriction function in a textbox.

For aspx server side textbox control

For html textbox control

You can restrict any other character or number other than special characters too, just by simply add it in the list of characters to be restricted such as for example I want to restrict the character a too then the code will be

if (keychar == "'" || keychar == "`" || keychar == "a")

So this is the way to handle and restrict the special characters being entered in textbox using javascript.

0 comments:

Post a Comment