Jquery Validation OnBlur of textbox

Jquery Validation OnBlur of textbox


The HTML code-sample

<div class="form-group error">
    <label for="inputEmail3" class="col-sm-4 control-label">Order Number * </label>
    <div class="col-sm-8">
        <input type="text" class="form-control" id="txtOrderNumber" placeholder="OrderNumber">
        <span class="help-block">Required.</span>
    </div>
</div>

The jQuery/JavaScript code-sample

$(function () {
    //Validation for Update devices input.
    $("#txtFormGroup input").blur(function () {
        validateDevice();
    });
});

var validateDevice = function () {
    if ($(this).val() == "") {
        $('.error').addClass("has-error");
    }
};



ANIL SINGH

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://www.code-sample.com and http://www.code-sample.xyz
My Books - Google Amazon and Flipkart Book Store!

You Might Also Like
Post a Comment
www.code-sample.com/. Powered by Blogger.
ASK Questions
SQL Server NodeJs TypeScript JavaScript Angular SQL Server My Book