Asp.net programming we consider all important topic for knowledge about controls,web Services, JSON, Ajax, database, and interview related Question. In this Asp.net and sql server tutorial blog we give many examples of jquery as like How Play YouTube Video in Your Asp.net Website by URL, How to Play YouTube Videos in Asp.net by using Jquery , Jquery Change div background on mouseover in asp.net , JQuery UI Datepicker (Calendar) etc.

Thursday, September 4, 2014

Enable Disable Submit Button using jQuery

Using jQuery Enable Disable Submit Button in asp.net:



$(document).ready(function () {
    $("#submit").attr('disabled', 'disabled');
    $("form").keyup(function () {
        // To Disable Submit Button
        $("#submit").attr('disabled', 'disabled');
        // Validating Fields
        var name = $("#name").val();
        var email = $("#email").val();
        var message = $("#message").val();
        var filter = /^[\w\-\.\+]+\@[a-zA-Z0-9\.\-]+\.[a-zA-z0-9]{2,4}$/;
        if (!(name == "" || email == "" || message == "")) {
            if (filter.test(email)) {
                // To Enable Submit Button
                $("#submit").removeAttr('disabled');
                $("#submit").css({
                    "cursor": "pointer",
                    "box-shadow": "1px 0px 6px #333"
                });
            }
        }
    });
    // On Click Of Submit Button
    $("#submit").click(function () {
        $("#submit").css({
            "cursor": "default",
            "box-shadow": "none"
        });
        alert("Form Submitted Successfully..!!");
    });
});

Jquery Related Other post:


How to disable/enable input field on click with jQuery:


Enable Disable Submit Button using jQuery
For the Example check Next Post :jquery disable or Enable submit button after validation

Asp.net Related Other Post:

Here we give the list of Examples related to gridview:

No comments:

Post a Comment