下面是我的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);
Run Code Online (Sandbox Code Playgroud)
现在我有"清除文件"按钮的原因是因为如果你点击按钮,它将清除文件输入中的任何内容.我如何对其进行编码,以便在单击"清除文件"按钮时实际清除文件输入?
jquery ×1