I know to clear context of a textbox, using $('#textbox1').val(""); But how to clear context of a FileUpload control. I mean to erase the content of it's textbox. For example, I first choose a file using FileUpload control, which it shows c:\user\1.png. Now I want to clear it by using jQuery.
$('#FileUpload1').val("");
apprently does not work here.
$('#FileUpload1').val("");
won't work on ie.
document.getElementById("#FileUpload1").createTextRange().execCommand('delete');` will work on ie
or you can use
var file = document.getElementById("<%=FileUpload1.ClientID%>");
$(file).parent().html($(file).parent().html());
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With