HuyPV
Wednesday, November 3, 2010
<form id="frmF" onsubmit="return checkToSubmit();">
<input type="text" name="phone[]" value="" />
<input type="text" name="phone[]" value="" />
<input type="text" name="phone[]" value="" />
<input type="text" name="phone[]" value="" />
<input type="text" name="phone[]" value="" />
<input type=submit value="OK" />
</form>
function checkToSubmit() {
var valid = true;
$('input[name="phone[]"]', '#frmF').each(function(){var v = $(this).val(); if (!v.match(/^[0-9]+$/)) {alert('Digits'); valid = false; $(this).focus(); return false;/*to break .each!*/}});
return valid;
}
Title:
jQuery - Check multiple text input
Description:
<form id="frmF" onsubmit="return checkToSubmit();"> <input type="text" name="phone[]" valu...
...
Rating:
4