首页前端开发HTML如何点击a标签实现弹出input file上传文件对话框

如何点击a标签实现弹出input file上传文件对话框

时间2024-01-27 06:52:03发布访客分类HTML浏览748
导读:收集整理的这篇文章主要介绍了如何点击a标签实现弹出input file上传文件对话框,觉得挺不错的,现在分享给大家,也给大家做个参考。 htML 复制代码代码如下: <SPAN class=tag><<SP...
收集整理的这篇文章主要介绍了如何点击a标签实现弹出input file上传文件对话框,觉得挺不错的,现在分享给大家,也给大家做个参考。 htML

复制代码代码如下:
SPAN class=tag> SPAN class=tITle> div/SPAN> > /SPAN>
SPAN class=tag> SPAN class=title> a/SPAN> SPAN class=attribute> href/SPAN> =SPAN class=value> "###"/SPAN> > /SPAN> 添加图片SPAN class=tag> /SPAN class=title> a/SPAN> > /SPAN>
SPAN class=tag> SPAN class=title> input/SPAN> SPAN class=attribute> tyPE/SPAN> =SPAN class=value> "file"/SPAN> SPAN class=attribute> name/SPAN> =SPAN class=value> "image"/SPAN> SPAN class=attribute> class/SPAN> =SPAN class=value> "hidden"/SPAN> SPAN class=attribute> value/SPAN> =SPAN class=value> ""/SPAN> /> /SPAN>
SPAN class=tag> /SPAN class=title> div/SPAN> > /SPAN>

css

复制代码代码如下:
SPAN class=class> .hidden/SPAN> SPAN class=rules> {
SPAN class=rule> SPAN class=attribute> display/SPAN> :SPAN class=value> none; /SPAN> /SPAN>
SPAN class=rule> } /SPAN> /SPAN>


复制代码代码如下:
jquery
$('a').on('click', function(e) {
e.preventDefault();
$(this).closest('input[type=file]').trigger('click');
} )

声明:本文内容由网友自发贡献,本站不承担相应法律责任。对本内容有异议或投诉,请联系2913721942#qq.com核实处理,我们将尽快回复您,谢谢合作!

a标签上传文件"

若转载请注明出处: 如何点击a标签实现弹出input file上传文件对话框
本文地址: https://pptw.com/jishu/587864.html
HTML中data自定义属性的使用和插件应用介绍 checkbox的indeterminate属性使用介绍

游客 回复需填写必要信息