This is my html:
<input type="text" name="folderName">
Here, I want to validate the textbox value by not allowing to key in special characters and space. But it should allow underscore.
How to validate this textbox?
This is my html:
<input type="text" name="folderName">
Here, I want to validate the textbox value by not allowing to key in special characters and space. But it should allow underscore.
How to validate this textbox?
Try like this
This return
false for special chars and spaces
and returntrue for underscore, digits and alphabets.
Fiddle: http://jsfiddle.net/7C5nP/
You may try to use this function:
You may try to use this function:
It works for me.
You can use jQuery + jQuery Validation Plugin. That will make it that easy:
This will allow the user only to type letters plus underscore
Link to the jQuery Plugin: http://formvalidator.net/index.html
You have to create a javascript function that will do the validation. You could find severals exemple around the web. You could take a look on that website: javascript-validation and pay attention to the Email Validation in Javascript part (you will have to adapt a little).