The problem of jquery.form.js denying access in IE and the input upload button must be actively clicked

The problem of jquery.form.js denying access in IE and the input upload button must be actively clicked

Let's take a look at the code first

<form id="uploadFileForm2" name="uploadFileForm2" enctype="multipart/form-data" method="post">
    <div class="upload-wapper mt20">
        <input type="file" name="excelfile" id="dataFile" class="dataFile" accept="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" />
        <a href="javascript:;" id="uploadFile" class="upload-file">Upload file</a>
        <div id="J_progress_label"></div>
    </div>
</form>

// Save import $("#uploadFile").click(function(){
    $("#dataFile").click()
})

When uploading using jquery.form.js in IE, access is suddenly denied. The simulated click event of jq is used. I found that in IE, unless you click the browse button of the file control, you do not have permission to upload the file. Then you need to submit it in the form of a form, and the enctype attribute must be included. In other words, you cannot use js to control the value of the file control to upload files.

If you think the file is ugly, you can use the CSS style to hide the file, then set the button to transparent and cover it. You can also use a div to wrap the <input type=”file”> tag to solve the problem. At the same time, pay attention to setting the CSS style. Note that the button position of the <input type=”file”> tag is different in Google and IE8.

Summarize

This is the end of this article about the jquery.form.js access denied issue in IE, and the input upload button must be clicked actively. For more information about IE jquery.form.js access denied issue, please search 123WORDPRESS.COM's previous articles or continue to browse the related articles below. I hope you will support 123WORDPRESS.COM in the future!

<<:  The difference between html form submission action and url jump to actiond

>>:  Detailed explanation of application scenarios of filters in Vue

Recommend

Summary of the differences between count(*), count(1) and count(col) in MySQL

Preface The count function is used to count the r...

How to configure path alias for react scaffolding

The react version when writing this article is 16...

The difference between html Frame, Iframe and Frameset

10.4.1 The difference between Frameset and Frame ...

Some common properties of CSS

CSS background: background:#00ffee; //Set the back...

Use xshell to connect to the Linux server

Benefits of using xshell to connect to Linux We c...

Solution for multiple Docker containers not having the same port number

Background In Docker, four containers are created...

React Hooks Common Use Scenarios (Summary)

Table of contents 1. State Hook 1. Basic usage 2....

The final solution to Chrome's minimum font size limit of 12px

I believe that many users who make websites will ...

js realizes the magnifying glass function of shopping website

This article shares the specific code of js to re...

A brief understanding of the difference between MySQL union all and union

Union is a union operation on the data, excluding...

How to run Spring Boot application in Docker

In the past few days, I have studied how to run s...

How to use the vue timeline component

This article example shares the specific implemen...