I want to apply validation through jquery in my forms and for that I require the “name” attribute of the TextBoxes on my form which are generated by the ASP.Net automatically. Is there any way I can get the name of elements in javascript just like:
<script>
'<%= txt.ClientID %>'
</script>
I am using the following type of jquery validation:
$(".selector").validate({
rules: {
// simple rule, converted to {required:true}
name: "required",
// compound rule
email: {
required: true,
email: true
}
}
})
You might do it like this…
Or even…