JS Button Click by Visitor After Page Load

Every visit on the page where you place this snippet, will trigger an element click, which you can specify by its ID.

<script>
function loadEvent() {
           document.getElementByID("clickbutton").click(); //the ID you want to be clicked
           console.log("works"); //just to check if the functions runs
        }
window.onload = loadEvent;
     
    
</script>

WHERE TO PLACE THIS CODE?

Put it somewhere on your page, where the element which should be clicked lives.

Pleasure?

Please share your thumbsup, suggestions, edits, and questions within my comment section down there. 

I love posting snippets for you, but with a bit of feedback, it gets even more fun. 😀

Sharing is caring:

Share on xing
Share on linkedin
Share on whatsapp
Share on facebook
Share on twitter
Share on email

Leave a Reply

Your email address will not be published.