我将 onchange 添加到 input type = file 中,它确实有效,我最初有一个单独的上传按钮,但我更喜欢这个。但是,上传文件后,它会将输入文件类型恢复为默认参数。
<table>
<td valign="top" class="ms-formbody" id="attachmentsOnClient" style="width: 424px">
<input type="file" name="fileupload0" onchange='OkAttach()' id="onetidIOFile" size="56" title="Drag files here or click to upload"style="height:100px; width:420px"> </input>
</td>
</table>
上传后就变成这样了
<input type="file" name="fileupload0" id="onetidIOFile" size="50" title="name"> </input>
刷新页面即可恢复原始代码。
我希望将输入文件类型保留为定义的值,而不是每次上传文件时都将其恢复。
尝试像这样刷新值 $('#onetidIOFile').val('');在JQ