TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
narasiman rao
NA
519
768.4k
Validate the textbox using JQuery
Jun 12 2016 3:32 AM
i have one text box.
Name textbox
Validate the above textbox using Jquery.
for that download the jquery 1.4.1 and put in that project script.
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
</head>
<body>
<form id="form1" runat="server">
<div>
<script src="Scripts/jquery-1.4.1.min.js" type="text/javascript"> <pre
<script src="Scripts/jquery.validate.js" type="text/javascript"></script>
<script type ="text/javascript" >
$(document).ready(function () {
$("#form1").validate({
rules: {
<%=txtName.UniqueID %>:{
required:true
},
}
},
messages: {
<%=txtName.UniqueID %>:{
required: "Name should not be empty"
},
}
});
});
</script>
<style type ="text/css" >
label.error {
color: red;
display:inline;
}
.error
{
height: 26px;
}
</style>
<br />
Name <asp:TextBox ID="txtName" runat="server"></asp:TextBox>
<br />
<br />
<asp:Button ID="btnSubmit" runat="server" Text="Submit" CssClass="error"
onclick="btnSubmit_Click" />
</div>
</form>
</body>
</html>
i have one text box validate that textbox using jquery.
When i run as follows
Name textbox
Without typing in text box and click submit message not shown.
what is the mistake in my above code.
Reply
Answers (
2
)
image and image button in asp.net C#
How to data Insert by Web api In window form Application