使输入类型为“文件".用按钮隐藏 [英] making a input type "file" hidden with button

查看:69
本文介绍了使输入类型为“文件".用按钮隐藏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道这是否可行? Google一无所获.

I was wondering if this is doable? Google comes up with nothing.

基本上,我希望我的按钮在被选中时进行模拟,从而允许用户上传文件.我已经读过带有标签的标签,但是我需要使用按钮来做UX/UI

Basically i want to my button to simulate when selected, allowing users to upload files. I've read its possible with labels, but i need to do with a button to do UX/UI

<button style="position:fixed;bottom:10px;right:70px" type="button" class="btn btn-default">
    <input type="file" id="files" visbility="hidden" />
    <span class="glyphicon glyphicon-folder-open" aria-hidden="true"></span>
</button>

当前,我的按钮如下所示: 对此:

Currently my button looks like this: to this:

推荐答案

您实际上可以使用label进行操作,只需隐藏input.

You can actually do it with label, you just have to hide the input.

<!-- head -->
<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css" rel="stylesheet"/>

<!-- body -->
<label for="upload">
      <span class="glyphicon glyphicon-folder-open" aria-hidden="true"></span>
      <input type="file" id="upload" style="display:none">
</label>

这篇关于使输入类型为“文件".用按钮隐藏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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