Tôi có các trường nhập tệp trong một nhóm như dưới đây. Tôi muốn tất cả chúng là những trường bắt buộc.Kiểm tra tệp đầu vào JQuery
<!-- file upload group -->
<div class="Fieldset FileUpGroup">
<span class="Legend">File Upload Group: (required)</span>
<input name="fileUploads[]" type="file">
<input name="fileUploads[]" type="file">
<input name="fileUploads[]" type="file">
</div>
Tôi có JQuery sau đây để xác thực, nhưng nó chỉ xác thực giá trị đầu tiên.
$('.FileUpGroup').each(function() {
if($(this).find('input[type=file]').val() == '') {
Response('- Upload file not selected!', true);
$(this).addClass('Error').fadeOut().fadeIn();
return false;
}
else {
$(this).removeClass('Error');
}
});
Cảm ơn bạn!
Cảm ơn bạn! Nó hoạt động tuyệt vời. – user1108996
Vui mừng được giúp đỡ :) – AlienWebguy
Đã làm việc tuyệt vời. Cảm ơn rất nhiều. –