Home > Forum > Jquery > How to validate textbox using jquery in asp.net?

How to validate textbox using jquery in asp.net?

by Thamil   on Jul 07, 2013   Category: Jquery  |  Views: 18619    |  Points: 5   |  Gold 

how to validate the empty textbox using jquery when clicks on submit button.

Bookmark and Share:
  User Reply  | Ask a question  |   Reply 
  Re :How to validate textbox using jquery in asp.net?   
by Thamil
on Jul 7 2013 6:25AM
Points : 10
below jquery code will help you how to validate empty textbox while submit.

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm28.aspx.cs" Inherits="WebApplication1.WebForm28" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>

<script type="text/javascript" src="Javascript/jquery-1.4.2.min.js"></script>

<script type="text/javascript" language="javascript">
$(document).ready(function() {
$('#Button1').click(function() {
if ($("#TextBox1").val()!="") {
return true;
else {
alert('Please enter the text')
return false;


<form id="form1" runat="server">
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click" />

Recent Post

Latest Posts

1 Mature purlieus New! Forum