Monday, April 28, 2014

JQuery validate textbox in

Title : How to validate text box using JQuery in

Description : Why we have to apply validation on input control?Because of this functionality we can restrict the input data as per our need.Now we will see how to do the validation using client side script(JQuery).If we want to develop the validations in we have to use validation 
control for specified control.

<head runat="server">
<script type="text/javascript" src="Javascript/jquery-1.4.1.min.js"></script>
<script type="text/javascript" language="javascript">
$(document).ready(function() {
$('#doValidate').click(function() {
if ($("#allowData").val()!="") {
alert('Enter Text'+"#allowData").val());
return true
else {
alert('Please enter valid data')
return false;
<form id="form1" runat="server">
<asp:TextBox ID="allowData" runat="server"></asp:TextBox>
<asp:Button ID="doValidate" runat="server" Text="Validate" OnClick="doValidate_Click" />