使用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验证插件无关,那么请不要使用该标签。否则,请尝试并显示相关代码。谢谢。在我问之前,我搜索并找到了这个。不管我怎么解决。谢谢