Bug Tracker

Opened 11 years ago

Closed 11 years ago

#12917 closed bug (plugin)

input type[file] can't be reset with val('') in IE (+ workaround)

Reported by: matthew@… Owned by:
Priority: low Milestone: None
Component: attributes Version: 1.8.3
Keywords: Cc:
Blocked by: Blocking:


Due to IE's inane security manager, you can't set the value of an input[file], even to "" to reset it.

There's a workaround that might be useful to pull into jQuery. It wraps a form around the input element, calls reset on it, then removes the parent element:


function reset(e) {

e.wrap('<form>').closest('form').get(0).reset(); e.unwrap();


This workaround works in all browsers:


Change History (1)

comment:1 Changed 11 years ago by Timmy Willison

Component: unfiledattributes
Priority: undecidedlow
Resolution: plugin
Status: newclosed

Sounds like this would be good for a jQuery plugin like file upload.

Note: See TracTickets for help on using tickets.