点击输入框显示打开的文件对话框,但不点击选择文件按钮 [英] click on input box to show open file dialog but not click on choose file button

查看:316
本文介绍了点击输入框显示打开的文件对话框,但不点击选择文件按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个输入框,我希望用户点击输入框来显示打开的文件对话框,并在同一个输入框中显示文件名。但如果我使用输入类型=文件,它会显示选择文件按钮,我不想显示按钮。



html:

 < div类= 文件上传 > 
< input type =fileclass =filename =image/>
< / div>

< div class =fileupload>
< input type =fileclass =filename =attachement/>
< / div>

http:// jsfiddle.net/EctCK/
**我没有这样做,我该如何隐藏选择文件按钮?

解决方案 div>

你可以在一个样式化的按钮或其他元素上覆盖一个透明的< input type =file/>

 < input type =filestyle =opacity:0;/> 

请参阅 JSFiddle 的工作演示。


I have an input box and I want user to click on the input box to show the open file dialog and show the filename in the same input box. But if I use the input type="file", it will show the "choose file button", I dont wan to show the button. How can I do it?

html:

<div class="fileupload">
    <input type="file" class="file" name="image" />
</div>

<div class="fileupload">
    <input type="file" class="file" name="attachement" />
</div>

http://jsfiddle.net/EctCK/ ** I dont wan this, how do I hide the choose file button?

解决方案

You can overlay a transparent <input type="file"/> over a styled button or other element.

<input type="file" style="opacity:0;"/>

See this JSFiddle for a working demo.

这篇关于点击输入框显示打开的文件对话框,但不点击选择文件按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆