Design a site like this with WordPress.com
Get started

How to catch a Click event in JavaScript?

<html>
    <button id="ButtonId">
        Click Here!
    </button>

    <script>
        document.getElementById('ButtonId').onclick = function(e) 
        {
            alert('clicked');
        }
    </script>
</html>

Published by Christian Foster

Code-blooded, coffee-lover, tall, dark and chubby. I love to draw, has motion-sickness and a sleepy-head. BTW, graduate of BS Computer Science, Associate in Computer Science and certified UiPath RPA Developer. Loyal to my partner and a father of a cute bouncing baby daughter!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: