How To Refer Html Element In Jquery Validation In Content Page
I have master and content page in asp .net web application. In my content page I am doing jquery validation. I have html element without runat='server' and I don't know how to refe
Solution 1:
After taking a quick look at the API Documentation it appears to me that the firstName
/ surname
items are supposed to link to the Name
of an element
Could you please try it after setting the inputs up like so:
<inputtype="text"id="firstName" name="firstName"class="InputText" size="30" />
<inputtype="text"id="surname" name="surname"class="InputText" size="30" />
Solution 2:
for writhing jquery-validate rules you should use name of elements not their ids!
set name for your elements and then use the name:
<select name="nameOfTitle" id="nameTitle" runat="server"class="InputText">
<option value="-1">--Select--</option>
<option value="Mr.">Mr</option>
<option value="Mrs.">Mrs</option>
<option value="Miss.">Miss</option>
</select>
and in jquery validate use:
rules:
{
nameOfTitle: { required: true },
},
messages:
{
nameOfTitle: { required: "Title is required" },
}
you should do the same for your other inputs as well.
Post a Comment for "How To Refer Html Element In Jquery Validation In Content Page"