1st download jQuery from google i e : jquery-1.10.2.min.js
aspx.aspx:
<body>
<form id="form1" runat="server">
<div>
<script src="jquery-1.10.2.min.js" type="text/javascript"></script>
<script src="Validation.js" type="text/javascript"></script>
<asp:TextBox ID="txtname" runat="server"></asp:TextBox>
<asp:Button ID="btnsubmit" runat="server" />
</div>
</form>
</body>
Validation.js:
$(document).ready(function () {
$('#btnsubmit').click(function () {
if ($('#txtname').val() == '') {
alert("please enter the name");
return false;
}
});
});
aspx.aspx:
<body>
<form id="form1" runat="server">
<div>
<script src="jquery-1.10.2.min.js" type="text/javascript"></script>
<script src="Validation.js" type="text/javascript"></script>
<asp:TextBox ID="txtname" runat="server"></asp:TextBox>
<asp:Button ID="btnsubmit" runat="server" />
</div>
</form>
</body>
Validation.js:
$(document).ready(function () {
$('#btnsubmit').click(function () {
if ($('#txtname').val() == '') {
alert("please enter the name");
return false;
}
});
});
No comments:
Post a Comment