So I am using jQuery's .change() function to trigger validation on the other fields in that particular table. See code below.... The problem I am running into is this: If I type something in an input field, and then erase it, it still considers it changed, and requires the other fields. I can see this being a problem for the user, is there anyway around this?
p.s. class="R" is from my custom validation and makes it a required field.
$('#t1 :input').change(function(){
var $t1Input = $('#t1Table :input:not(input[type=hidden])');
var hasData = false;
$t1Input.each(function(){
if($(this).val().length > 0){
hasDatat1 = true;
return false;
}
});
// Change class of input field to "R" if something has been changed
if(hasDatat1)
$t1Input.addClass('R');
else
$t1Input.removeClass('R');
});