JavaScript
$( yourElement ).click( yourFunction );
Html
<html>
<!-- heading -->
<head>
<meta charset="utf-8">
<title>Example</title>
</head>
<!-- page -->
<body>
<!-- connect the library jQuery -->
<script src="https://dir.by/example_lib/jquery/jquery-3.3.1.min.js"></script>
<!-- HTML Elements -->
<input type='button' id="myElement1" value='My Button'>
<!-- JavaScript -->
<script>
// the page has opened
$( function()
{
// set event click
$("#myElement1").click(function(event)
{
alert("Hello");
});
});
</script>
</body>
</html>