$scope vs scope in angularjs

JavaScript/jQuery Special Characters Validation example

Hello everyone, I am going to share the special characters validation using JavaScript/jQuery.
The input special characters  [email protected]#$%^&*()_+~{}[]';:"/.,<>?

Example as given below

$(function () {
   $("form :input[type='text']").on("keyup", function (e) {
        var inputTextId = $('#' + this.id);
        var inputText = inputTextId.val();

        var errorFor = this.id;
        if (!isValidChar(inputText)) {
            $('#' + this.id).val('').valid();       
            setTimeout(function () { replaceErrorMsg(errorFor); }, 100);

function isValidChar(str) {
    return !/[~`!#$%\^&*+=\-\[\]\\';,/{}|\\":<>\?]/g.test(str);

function replaceErrorMsg(errorFor) {
   $("label[for='" + errorFor + "'].help-block").html("Input parameter is Invalid.");

For more detail, go to links


Hey! I'm Anil Singh. I author this blog. I'm Active Blogger, Programmer. I love learning new technologies, programming, blogging and participating the forum discussions more...
My Blogs - http://code-sample.com and http://code-sample.xyz
My Books - Interview Questions and Answers Books- Get Your Book in 15+ Digital Stores Worldwide..

You Might Also Like
www.code-sample.com/. Powered by Blogger.
ASK Questions