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');
})