如果仅输入了输入值,则用户应该能够上传文件。但是,一旦我单击按钮,上传文件的窗口就会弹出。除非用户在输入中输入值,否则我不希望它弹出文件如下所述。这些是输入:
<input type="text" id="id" placeholder="Enter Audit ID" autocomplete="off">
<input type="text" id="email_id_upload" placeholder="Enter Email_id " autocomplete="off">
这是上传者:
<form>
<input type="file" name="file" id="file"><br>
<input type="button" name="submit_file" value="Submit">
</form>
这是检查用户是否输入了所有值的 Js:
$('#file').click(function(){
var email_id_upload= $('#email_id_upload').val();
var id = $('#id').val();
if(email_id_upload.length !==0 && id.lenght !==0)
{
//allow upload window to pop up
}
else
{
if(email_id_upload.length ===0 && id.length ===0)
{$('#message_content2_1').html("<span style='color:red'>Please fill email id and audit id</span>");}
else{
if(email_id_upload.length ===0)
{$('#message_content2_1').html("<span style='color:red'>Please fill email id</span>");}
if(id.length ===0)
{$('#message_content2_1').html("<span style='color:red'>Please fill email id and audit id</span>");}
}
}
});