按钮不显示菜单 [英] Button not displaying menu

查看:29
本文介绍了按钮不显示菜单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大约一周前,我发布了一个问题,但无法得到答案,因为我不知道如何使用 jsfiddle 或 codepen,但我想通了.

我的问题是该按钮现在不起作用,如果您单击它,它将显示文件搜索框,这是示例:

https://codepen.io/anon/pen/bWaYzJ

现在,如果我将插件从元素中分离出来,那么按钮将再次起作用.

解决方案

首先,删除对 MultiFile 源文件的引用 - 这就是导致MultiFile is not a function"错误的原因.您需要将 MultiFile 直接包含在 codepen 的源代码中(正如您已经拥有的那样).

其次,标签需要包装输入,并且不能使用for属性(因为它依赖于目标的name属性,你没有设置):

上传<label class="button">上传文件<input type="file" id="exampleFileUpload" class="show-for-sr" 多个>

About a week ago i posted a question but couldn't get it answer because i didn't know how to use jsfiddle or codepen but i figured it out.

my problem is that the button doesn't work now if you click around it it will display the file search box this is the sample:

https://codepen.io/anon/pen/bWaYzJ

<label> Uploads
  <label for="exampleFileUpload" class="button">Upload File</label>
  <input type="file" id="exampleFileUpload" class="show-for-sr">
</label>

now if i detached the plugin from element then button works again.

解决方案

First, remove the reference to the MultiFile source file - that's what causes the "MultiFile is not a function" error. You will need to include the MultiFile directly in the source for the codepen (as you already have).

Second, the label needs to wrap the input, and it cannot use the for attribute (since that relies on the name attribute for the target, which you have not set):

<div> Uploads
  <label class="button">Upload File
    <input type="file" id="exampleFileUpload" class="show-for-sr" multiple>
  </label>
</div>

这篇关于按钮不显示菜单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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