I hanged to get all controls based on css class name using find function of jquery.I tried out with this but it's not working.
Can You suggest how to get out of this.
- <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="SignUpForm.aspx.cs" Inherits="DropBox.SignUpForm" %>
<!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>Sign Up for Drop Box</title>
<link href="CSS/DropBox.css" rel="stylesheet" type="text/css" />
<script src="Jquery/jquery-1.7.2.min.js" type="text/javascript"></script>
<script type="text/javascript">
function myfunction() {
textboxes = $('#RegisterTable').find('.requiredField');
alert(textboxes.length);
textboxes.each(function (index) {
if (this.value.length == 0) {
alert('Hello');
//do something here
}
});
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div style="margin-left: 8%; background-color: rgba(221,221,221,0.3); border: 1px #e2e2e2 solid;
-moz-border-radius: 0.45em; border-radius: 0.45em; padding: 20px; width: 80%;">
<table border="0" cellpadding="3" cellspacing="2" width="100%">
<tr><td>
<font class="FPtitleFont">
<asp:Literal ID="DropBoxAuthenticationTitle" runat="server" EnableViewState="False">Sign Up for Drop Box</asp:Literal>
</font>
</td>
</tr>
<tr><td><hr /></td></tr>
<tr>
<td valign="top" align="left">
<div>
<asp:Label ID="MessageLabel" runat="server" CssClass="ErrorMessage" Visible="False"></asp:Label>
<table class="normal" id="RegisterTable">
<tr>
<td nowrap="nowrap" width="100">
<strong>
<asp:Literal Text="Name" ID="UserNameLabel" runat="server" />
</strong>
</td>
<td>
<asp:TextBox runat="server" ID="UserNameTextBox" CssClass="requiredfield" />
</td>
</tr>
<tr>
<td nowrap="nowrap" width="100">
<strong>
<asp:Literal Text="Email" ID="UserEmailLiteral" runat="server" />
</strong>
</td>
<td>
<asp:TextBox runat="server" ID="UserEmailTextBox" CssClass="requiredfield" />
</td>
</tr>
<tr>
<td nowrap="nowrap" width="100">
<strong>
<asp:Literal Text="Contact" ID="UserConatactLiteral" runat="server" />
</strong>
</td>
<td>
<asp:TextBox runat="server" ID="UserConatactTextBox" CssClass="requiredfield" />
</td>
</tr>
<tr>
<td nowrap="nowrap" width="100">
<strong>
<asp:Literal Text="Password" ID="UserPasswordLiteral" runat="server" />
</strong>
</td>
<td>
<asp:TextBox runat="server" ID="UserPasswordTextBox" TextMode="Password" CssClass="requiredfield" />
</td>
</tr>
<tr>
<td nowrap="nowrap" width="100">
<strong>
<asp:Literal Text="Confirm Password" ID="UserConfirmPasswordLiteral" runat="server" />
</strong>
</td>
<td>
<asp:TextBox runat="server" ID="UserConfirmPasswordTextBox" TextMode="Password" CssClass="requiredfield" />
</td>
</tr>
</table>
<br />
<asp:Button Text="Sign Up" runat="server" CssClass="button" OnClientClick="myfunction();" />
</div>
</td>
</tr>
</table>
</div>
</form>
</body>
</html>
I am getting alert(textboxes.length); as 0;
Please Suggest. Thanks in Advance :)