JSFiddle - React, Tailwind, and code Playground
by Danish Farman
HTML
<form class="attachmentsUpload" action="/UploadHandler.ashx" method="post" enctype="multipart/form-data">
<input type="file" class="file" name="file" />
</form>
JavaScript
$(".attachmentsUpload input.file").live("change", function () {
if ($(".attachmentsUpload input.file").val() == "") {
return;
}
// your ajax submit
alert("submit value of the file input field=" + $(".attachmentsUpload input.file").val());
//$(".attachmentsUpload input.file").replaceWith('<input type="file" class="file" name="file" />');
});