码迷,mamicode.com
首页 > Web开发 > 详细

jq简单仿上传文件

时间:2017-09-10 16:44:28      阅读:237      评论:0      收藏:0      [点我收藏+]

标签:change   col   file   pop   display   hang   nbsp   log   bsp   

html:

<div>
    <input id="lefile" type="file" style="display:none">
    <input id="photoCover" type="text">
    <a class="btn-up">点击上传文件</a>
</div>

js:

$(‘.btn-up‘).on(‘click‘,function () {
            $(‘input[id=lefile]‘).click();
        })
        $(‘input[id=lefile]‘).change(function() {
            $(this).next(‘input‘).val($(this).val().split(‘\\‘).pop());
        });

 

jq简单仿上传文件

标签:change   col   file   pop   display   hang   nbsp   log   bsp   

原文地址:http://www.cnblogs.com/hjbky/p/7501201.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!