I know input type=‘file’ can do it. But I saw that some websites use p to bind an event, and I don’t know how to implement it.
温故而知新,可以为师矣。 博客:www.ouyangke.com
Dear, this is easy to do, you bind the p click event, and then click the hidden input[file] input box!
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Demo</title> <script> function showResurce() { document.getElementById('resurce').click(); } </script> </head> <body> <p onclick="showResurce()">点我</p> <input id="resurce" type="file" style="display: none"> </body> </html>
One solution is to have a hidden input file somewhere else and trigger it after clicking p.
Dear, this is easy to do, you bind the p click event, and then click the hidden input[file] input box!
One solution is to have a hidden input file somewhere else and trigger it after clicking p.