Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/70.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用jQuery仅验证第一次上载输入_Jquery_Validation_Image Uploading - Fatal编程技术网

使用jQuery仅验证第一次上载输入

使用jQuery仅验证第一次上载输入,jquery,validation,image-uploading,Jquery,Validation,Image Uploading,我有一个有两个上传输入的表单 <form action="http://localhost/royalshop/administrator/submit_product" method="post" accept-charset="utf-8" id="myform" enctype="multipart/form-data"> <div class="productpicstables"> <input type="file" name="file

我有一个有两个上传输入的表单

<form action="http://localhost/royalshop/administrator/submit_product" method="post" accept-charset="utf-8" id="myform" enctype="multipart/form-data">  
  <div class="productpicstables">
    <input type="file" name="file1" />
  </div>
  <div class="productpicstables">
    <input type="file" name="file2" />
  </div>
</form>

我只想用jQuery验证第一个。我该怎么做

它应该是必需的,最好是512*512的大小

谢谢。

请使用相同的名称:

$('input[type="file"]').each(function() {
var $this = $(this);
if ($this.val() == '') { 
    Response('- Upload file not selected!', true);
    $this.addClass('Error').fadeOut().fadeIn();
    return false;
} else {
    $this.removeClass('Error');
}

}))

关闭并格式化标签嵌套如果这个问题与jQuery验证插件无关,那么请不要使用该标签。否则,请尝试并显示相关代码。谢谢。在我问之前,我搜索并找到了这个。不管我怎么解决。谢谢