i try to customize the rule of the JQuery validation plugin and I'm almost done. The only problem I got is that the function $("<%=txtUserl.UniqueID %>").val() return undefined. How can I get the value of that textbox ?
$("#aspnetForm").validate
(
{
rules:
{
<%=txtUser.UniqueID %>:
{
required: true,
remote: "CheckUser.aspx?User=" + $("#<%=txtUser.ClientID %>").val()
}
},
messages:
{
<%=txtUser.UniqueID %>:
{
remote: "Invalid user"
}
}
}
);
And in my webform
<asp:TextBox ID="txtUser" runat="server" TabIndex="1" />
UPDATE
I change to use ClientID instead of UniqueID. Also, I put my javascript code at the end of my file instead of in the beginning of the file.
Now, the problem I got is txtUser.val() return an empty string "". in fact, I notice that it's return the old value of the textbox if I change the value. It's doesn't return the current value, which is want I need...