0

enter image description here

I have attached an image. When I try to click "X" icon below the image I am able to remove the file but the file name at right side of "Choose File" is still display. Could anybody tell me how to reset it back.

I am using following code to remove the image.

$('div').on('click', '.closeDiv', function(e){
            var closest = $(this).closest('td');
            var id = closest.find('div:first');
            $(this).prev().remove();
            $(this).remove();
            closest.find('span:first').html('');
            $('#'+id).val("");
        })
S S
  • 1,443
  • 2
  • 12
  • 42

1 Answers1

1

Try this:

$('#file_id').val('');
// It will remove the selected file. Use it inside your function.
Mayank Pandeyz
  • 25,704
  • 4
  • 40
  • 59