Click a button programmatically - JS

前端 未结 5 1747
忘掉有多难
忘掉有多难 2020-12-01 17:40

I\'ve seen this done in other webapps, but I\'m fairly new to Javascript and can\'t really figure this out on my own. I want to create a Google Hangout programmatically. How

5条回答
  •  旧时难觅i
    2020-12-01 18:35

    window.onload = function() {
        var userImage = document.getElementById('imageOtherUser');
        var hangoutButton = document.getElementById("hangoutButtonId");
        userImage.onclick = function() {
           hangoutButton.click(); // this will trigger the click event
        };
    };
    

    this will do the trick

提交回复
热议问题