下面是我有显示文件输入和一个“清除文件”按钮的jQuery代码的一部分。如何清除文件输入
var $imagefile = $('<input />').attr({
type: 'file',
name: 'imageFile',
class: 'imageFile'
});
$image.append($imagefile);
var $imageclear = $('<input />').attr({
type: 'button',
name: 'imageClear',
class: 'imageClear',
value: 'Clear File'
});
$image.append($imageclear);
现在我有“清除文件”按钮的原因是因为如果你点击按钮,那么它将清除文件输入中的任何东西。我怎么编码它,以便它在我点击“清除文件”按钮时实际清除文件输入?
看到这个:http://stackoverflow.com/questions/1043957/clearing-input-type-file-using-jquery – 2012-03-08 12:41:53
见这也https://forum.jquery.com/topic/how-要清除一个文件输入即ie – 2015-07-21 15:02:51