The file field in IE cannot be emptied with jquery to reset the file domain _jquery

Source: Internet
Author: User
Sometimes in the file upload will encounter a situation is the need to reset the entire form, but the problem, the other browsers do not ask any questions, directly reset form or trigger type for reset button click event on OK, but IE is wonderful, The file field in IE can not be emptied, you may see that there is no value, but you can print out to see what you know:
Copy Code code as follows:

var fileval = $ (' input[type= ' file '] '). Val ();
alert (fileval);

Print or reset before the selection of the file information, this should be swollen mody, check a lot of data found in IE can be used in the following ways to solve
Copy Code code as follows:

$ (' input[type= ' file '] '). attr (' value ', ');
Or
$ (' input[type= ' file '] '). Val (');

Don't forget to reset the form, of course.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.