Katy93,
<!DOCTYPE html>
<html>
<head><title>Test</title>
<style type="text/css">
.err{
border-bottom: 2px solid #F90A0A;
}
.ok{
border-bottom: 2px solid #34F458;
}
</style>
<script src="https://code.jquery.com/jquery-3.3.1.min.js"></script>
<script>
$(function(e){
$("form").on("input", "table input", function() {
var error_message = "Только цифры";
var pattern = /^\d+$/;
var num = this.value.trim();
var ok = pattern.test(num);
$(this).removeClass("ok err");
if(num) {
$(this).addClass(ok ? "ok" : "err");
}
var index = $("form table input").index(this);
$("form table .error_form").eq(index).html(ok || !num ? "" : error_message);
})
});
</script>
</head>
<body>
<form method="POST" action="form.php">
<table border="0">
<tr>
<td><input type="text" value="" name="mass[age][]"></td>
<td><input type="text" value="" name="mass[exp][]"></td>
<td><input type="text" value="" name="mass[gender][]"></td>
</tr>
<tr>
<td><span class="error_form" ></span></td>
<td><span class="error_form" ></span></td>
<td><span class="error_form" ></span></td>
</tr>
<tr>
<td><input type="text" value="" name="mass[age][]"></td>
<td><input type="text" value="" name="mass[exp][]"></td>
<td><input type="text" value="" name="mass[gender][]"></td>
</tr>
<tr>
<td><span class="error_form" ></span></td>
<td><span class="error_form" ></span></td>
<td><span class="error_form" ></span></td>
</tr>
<tr>
<td><input type="text" value="" name="mass[age][]"></td>
<td><input type="text" value="" name="mass[exp][]"></td>
<td><input type="text" value="" name="mass[gender][]"></td>
</tr>
<tr>
<td><span class="error_form" ></span></td>
<td><span class="error_form" ></span></td>
<td><span class="error_form" ></span></td>
</tr>
<br>
</table>
<input type="submit" value="Отправить">
</form>
</body>
</html>