다른 답변에서 언급 한 것처럼 강력한 양식 유효성 검사 플러그인을 구현하지 않으려면이 게시물을 읽어야합니다. 사용이 code.I이 테이블에 ID를 준 http://jsfiddle.net/gnarf/NmpaM/3/
function checkForms() {
var rempty = /^\s*$/,
remail = /[a-z0-9!#$%&'*+\/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+\/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?/,
// narrow the scope of the check when called as an event handler
check = (this.nodeType) ? $(this).closest('tr') : $('tr');
check.each(function() {
var $row = $(this),
$inputs = $row.find("input.text_field"),
$btn = $row.find('input.button[name="commit"]'),
$email = $row.find('input[name="email"]'),
numempty = $inputs.filter(function() {
return rempty.test(this.value);
}).length;
if (numempty > 0 || !remail.test($email.val())) $btn.attr('disabled', 'disabled');
else $btn.removeAttr('disabled');
});
}
checkForms();
// just so it updates everytime the input changes:
$("input").bind('change keyup', checkForms);
당신이 추가 할 수 각 필드에 행 번호? (예 : first_name_1, last_name_1) – Avitus