When the elements are copied in IE, the values are not replicated, so the goal of emptying the file domain is achieved. And in Firefox, where the value will also be copied together, then we will be able to empty a bit of compatibility. The code is as follows:
The code is as follows |
Copy Code |
var file = $ ("#fileid"); File.after (File.clone (). Val ("")); File.remove (); |
jquery also has a way
The code is as follows |
Copy Code |
var afile = $ ("#" + picname); Afile.replacewith (Afile.clone ()); |
JS clears the file domain information.
First you need to use a <div> or <span> tag to wrap up your file area for us to get it, like the following
The code is as follows |
Copy Code |
<span id= "Pfile" ><input type= "file" name= "file" onkeydown= "return false" onpaste= "return false;" ></ Span></td>
|
Then execute the following JS before submitting the form
code is as follows |
copy code |
Document.getele Mentbyid ("Pfile"). InnerHTML = "<input type=" file "name=" file "onkeydown=" return false; "onpaste=" return false; " /> "; |