有人可以让我朝着这个代码片段的正确方向前进吗?
function validateForm() {
var flag=1;
//i have array containg values some values array[]
$(document).ready(function () {
alert("what happened");
//my form contains dynamically generated input fields..
//i can't seem to generate the ids..
var y=$("#inputfield"+array[1]).val();// seems to me like error in this line
//{validation code using y}
flag = 0;
});
if (flag === 0) {
return false;
}
}
这是html部分:
<form action="L4.php" method="post" onSubmit="return validateForm();">
<input type="submit">
</form>