I have several textboxes which I need to check before post them back. I do this with jQuery using each function. When the submit button is pressed (LinkButton1) I iterate over the textboxes and check they values:
<asp:textbox id="txt1" class="tocheck" runat="server />
<asp:textbox id="txt2" class="tocheck" runat="server />
<asp:textbox id="txt3" class="tocheck" runat="server />
$('#LinkButton1').click(function () {
var error = false;
$.each('.tocheck', function (i, v) {
checkVal(v.val());
});
});
But a runtime error is thrown saying v is undefined:

How can I retrieve the textbox value?
Thank you.
The issue is that you aren’t passing in a collection correctly.
try