Sunday, October 20, 2013

Validate ASP.Net Text Box Control Using Jquery for Blank Value

1 comment
In this tutorial  let us find out how to validate text box control  in  .net for blank value. If the text box value is null or empty then alert would be displayed to the user to enter value in text box.

In some of other posts related to jquery we discussed about: Jquery to validate file size of file upload control, Jquery to get Length of String

Jquery to Validate ASP.Net Text Box for Null or Empty value
<html xmlns="">
<head runat="server">
    <script src="//"></script>
    <script type="text/javascript">
        $(document).ready(function () {

            $('#btnsubmit').click(function () {

                var uname = $('#txtname').val();
                if (uname == '')
                    alert("Please Enter Name");


    <form id="form1" runat="server">
            <asp:TextBox runat="server" ID="txtname"></asp:TextBox>
            <asp:Button ID="btnsubmit" runat="server" Text="Submit"  />


1 comment: