Call Javascript Function On HTML Button Click
Here we consider how to call javascript function on button click.
Lets start with one example here.
Suppose we have a button inside div as shown below.

Inside Srcipt region, we have declared a javascript function.
function clickEvent() {
alert('hello!');
};
Now for calling this function on button click, we have two ways.
In this way, we make the OnClick event inline to the HTML part.

Inside HTML button, write, onclick="clickEvent();".
Now when button is clicked, the JavaScript function will be invoked.
Here, we can attach the js function with the HTML button inside Script region.
Inside Script region, find the HTML button by its ID and attach JS function.
document.getElementById("btnClick").onclick = clickEvent;
Now when button is clicked, the JavaScript function will be invoked.
That's all, by this way we can Call Javascript Function On HTML Button Click.