JSFiddle - React, Tailwind, and code Playground

HTML

<form name="myform">
    <input type="file" name="attachment" id="attachment" />
</form>
<br /><button id="clear">Clear Attachment</button>

JavaScript

$("#clear").click( function() {
    $("#attachment").val("");
    //document.myform.attachment.value = "";
})