Dưới đây là một phần của mã jquery mà tôi có hiển thị đầu vào tệp và nút "Xóa tệp".Cách xóa đầu vào tệp
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);
Bây giờ lý do tôi có nút "Xóa tệp" là vì nếu bạn nhấp vào nút thì nó sẽ xóa mọi thứ nằm trong đầu vào tệp. Làm thế nào để tôi mã nó để nó thực sự xóa đầu vào tập tin khi tôi bấm vào nút "Clear File"?
Xem này: http://stackoverflow.com/questions/1043957/clearing-input-type-file-using-jquery –
Xem này cũng https://forum.jquery.com/topic/how- to-clear-a-file-input-in-ie –