After an inputtypefile is verified, we always want to clear the values in the file field. In IE, due to security settings, it is not allowed to change the value of the file field. Next we will introduce the solution. After a file field (input type = "file") is verified, we always want to clear the values in the file field (otherwise the wrong file will still be submitted), and in IE, the security setting causes, is not allowed to change the value of the file field (that is, the val ("") cannot be used)
Obviously, we can only change our thinking, copy the input element, and then delete the original one.
When copying an element under IE, the value is not copied, so the object domain is cleared.
In Firefox, the values will be copied together, so we can clear the values and make them compatible.
The Code is as follows:
The Code is as follows:
Var file = $ ("# file ")
File. after (file. clone (). val (""));
File. remove ();