开发者

How to clear HTML File Input field (while using fakeupload) in IE?

开发者 https://www.devze.com 2023-02-28 21:41 出处:网络
We are using this solution to style our \"browse\" buttons. However, when we use this technique, our \"clear\" button no longer works in IE. In other words, it doesn\'t remove the fakepath. Still work

We are using this solution to style our "browse" buttons. However, when we use this technique, our "clear" button no longer works in IE. In other words, it doesn't remove the fakepath. Still works in Firefox and Chrome though.

<div id="upload_div">
  <li class="uploadlink">
    <div class="fakeupload">
     <input type="text" name="fakeupload" />
    </div>

  <input type="file" name="upload" id="uploadFile" class="realupload" onchange="this开发者_如何学运维.form.fakeupload.value = this.value;"/>     
  <input name="clearinput" type="button" value="Clear" onClick="clearFileInput('upload_div')">                
  </li> 
</div>

Clear button function:

function clearFileInput(tagId) { 
    document.getElementById(tagId).innerHTML = document.getElementById(tagId).innerHTML; 
}
0

精彩评论

暂无评论...
验证码 换一张
取 消