JavaScript
$("#Your Form ID").submit( function() { ... } )
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 -->
<form id="MyForm1" method="get" action="https://dir.by">
<input type='text' name='MyParam1' value='222'>
<input type='submit' value="My button">
</form>
<!-- JavaScript -->
<script>
// the page has opened
$( function()
{
// the event will be triggered when you press the button submit
$("#MyForm1").submit(
function() {
alert("Hello!");
return false; // the form will not be sent to the server
}
);
});
</script>
</body>
</html>