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

Native JS to implement hover drop-down menu

JS implements a hover drop-down menu. This is a s...

Docker installation of Nginx problems and error analysis

question: The following error occurred when insta...

Web design must have purpose, ideas, thoughts and persistence

<br />Introduction: This idea came to me whe...

Five things a good user experience designer should do well (picture and text)

This article is translated from the blog Usability...

MySQL table type storage engine selection

Table of contents 1. View the storage engine of t...

How to install docker on centos

Here we only introduce the relatively simple inst...

How to use tcpdump to capture packets in Linux system

Let me look at the example code first: 1. Common ...

CSS3 overflow property explained

1. Overflow Overflow is overflow (container). Whe...

Responsive layout summary (recommended)

Basic knowledge of responsive layout development ...

Select does not support double click dbclick event

XML/HTML CodeCopy content to clipboard < div c...

Vue implements image dragging and sorting

This article example shares the specific code of ...

CSS implements six adaptive two-column layout methods

HTML structure <body> <div class="w...

Why the explain command may modify MySQL data

If someone asked you whether running EXPLAIN on a...

JavaScript to show and hide the drop-down menu

This article shares the specific code for JavaScr...