Special characters <
, >
, %
, ''
, ""
, $
and ^
are not allowed in a textbox. I need to put a validation check to restrict these characters on submit along with the null check.
I wrote entire validation code in a function and calling it on click of the submit button, but the function is not recognised on click.
Please help me write some JavaScript code to achieve this functionality.
A much simpler way is to use indexOf in javascript,
Try this:
Try something like
In function you can get text from your textarea or what you are using. If data is valid function () should return true. Otherwise form wouldn't be submitted.