button functions html
snippet in html

javascript click event

user2734

<button onclick="myFunction()">Click me</button>

<p id="demo"></p>

<script>
function myFunction() {
  document.getElementById("demo").innerHTML = "Hello World";
}
</script>

button functions html

user9803

<script>
 function myFunction() {
   alert("ALERT");
 }
</script>
<button onclick="myFunction">Click</button>

button click function in js

user6944

<script>
  $(document).ready(function(){
    $('#MyButton').click(function(){
       CapacityChart();
    });
  });
</script>

<input type="button" value="Capacity Chart" id="MyButton" >