You can use the trigger method. There is no native trigger function in JavaScript. You can write one yourself, or you can directly use the jquery implementation:
var button1 = document.getElementById("button1");
var button2 = document.getElementById("button2");
button1.onclick = function(){alert("button1");trigger(button2,"onclick");}
button2.onclick = function(){alert("button2");}
function trigger(ele,event )
{ele[event]();}
You can also use a simpler way, which is to cover the image or hyperlink or other div to be clicked with the input, and then set the input Make it completely transparent, so that when you click on the picture, you actually click on the input, as follows:
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn