输入文件“No File Choosen”文本隐藏使用jquery MultiFile中的按钮 [英] input file "No File Choosen" text hide using button in jquery MultiFile

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

问题描述

我有以下输入文件:

I have following input file

<input type="file" id="sampleInput" name="files" onchange="return Plugins.sampleAction(this);"/>

在此文件输入中,我试图删除No File Choosen文本,以下修改

In this file input I'm trying to remove "No File Choosen" text, for that I did following modification

<input type="file" id="sampleInput" name="files" onchange="return Plugins.sampleAction(this);" style='display:none'/>
 <button id="image_alt" type="button">Select image</button>

<script type="text/javascript">
    $('#image_alt').addEventListener('click', function () {
        $('#sampleInput').click();
    });
</script>

但是当我点击这个按钮时,不会打开文件上载器窗口

but when I click button this one not opening the file up-loader window

推荐答案

试试这个

try this

<button id="image_alt" type="button">Select image</button>
  <p class="file_selected">File name</p>
<script type="text/javascript">
    $('#image_alt').on('click', function () {
        $('#sampleInput').click();
    });
    function changeVal(obj,cnt){
       $(cnt).text($(obj).val());
    }
</script>

这篇关于输入文件“No File Choosen”文本隐藏使用jquery MultiFile中的按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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