I have a jquery method that check special character as shown below:
function checkForSpecialChar(val) {
if (val != 0 && /^[a-zA-Z0-9- ]*$/.test(val) == false) {
return false;
}
return true;
}
This is working fine as it validate the value correctly.
However now I need to get all invalid characters for the val string and show it to the user.
So for example if val is = 123gdf$£!
It should get only the invalid character which is $£!.
Any idea how i can do that please?
Thanks in advance for any help.