How to click on the a tag to pop up the input file upload dialog box

How to click on the a tag to pop up the input file upload dialog box
html

Copy code
The code is as follows:

<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>Add image<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

Copy code
The code is as follows:

<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>


Copy code
The code is as follows:

jQuery
$('a').on('click', function(e) {
e.preventDefault();
$(this).closest('input[type=file]').trigger('click');
})

<<:  Detailed explanation of the difference between in and exists in MySQL

>>:  Solution to overflow:hidden failure in CSS

Recommend

Summary of basic usage of CSS3 @media

//grammar: @media mediatype and | not | only (med...

Steps to install MySQL using Docker under Linux

As a tester, you may often need to install some s...

MySQL 8.0 Window Function Introduction and Summary

Preface Before MySQL 8.0, it was quite painful to...

Classes in TypeScript

Table of contents 1. Overview 2. Define a simple ...

Understanding MySQL precompilation in one article

1. Benefits of precompilation We have all used th...

5 ways to quickly remove the blank space of Inline-Block in HTML

The inline-block property value becomes very usef...

How to understand JavaScript modularity

Table of contents 1. Browser support 2. export ex...

Multiple solutions for cross-domain reasons in web development

Table of contents Cross-domain reasons JSONP Ngin...

Linux checkup, understand your Linux status (network IO, disk, CPU, memory)

Table of contents 1. Core commands 2. Common comm...

Summary of MySQL Undo Log and Redo Log

Table of contents Undo Log Undo Log Generation an...

Simple CSS text animation effect

Achieve results Implementation Code html <div ...

MySQL 8.0.12 Quick Installation Tutorial

The installation of MySQL 8.0.12 took two days an...