Only first file input is validated. Any suggestions how to fix this? I tried with the .each, like suggested somewhere, but it still doesnt work.
Demo:
HTML:
<form method="post" action="<?php echo $_SERVER['PHP_SELF']."?".$_SERVER["QUERY_STRING"]; ?>" enctype="multipart/form-data" id="fnpMain">
<table class="ConTable">
<tr>
<td>Photo 1:</td>
<td> <input type="file" class="ipfile" name="pic[]" /> </td>
</tr>
<tr>
<td>Photo 2:</td>
<td> <input type="file" class="ipfile" name="pic[]" /> </td>
</tr>
<tr>
<td>Photo 3:</td>
<td> <input type="file" class="ipfile" name="pic[]" /> </td>
</tr>
</table>
<input type="submit" name="sub" value="submit" />
</form>
JQ:
<script type="text/javascript">
$(document).ready(function(){
$("#fnpMain").validate(
{
rules:{
Telefon:{required:true, exactlength:9, digits:true}
}
});
$("input[type=file]").each(function(){
$(this).rules("add", {
required:true,
accept: "jpe?g"
});
});
});
</script>