how do i validate dynamic textboxes which are generated at runtime using jQuery?
A:
I am not sure, but you can use something like this:
$(function() {
$('input').each(function() {
$('#' + this.id).live('onchange', function() {
// VALIDATION Code
});
});
Amr ElGarhy
2009-05-04 09:59:35
live() does not support change yet :(
Chad Grant
2009-05-04 10:11:06
So i think @Deviant answer below will work
Amr ElGarhy
2009-05-04 11:48:51
+1
A:
<%
TextBox tb = new TextBox();
tb.Attributes.Add("data-validateme","true");
Page.Controls.Add(tb);
%>
Which will add an HTML5 data attribute.
<input type="text" data-validateme="true" />
jQuery:
$(document).ready(function(){
$("*[data-validateme]").change(function(){
alert($(this).val());
});
});
Chad Grant
2009-05-04 10:10:41