Check out example codes for "button functions html". It will help you in understanding the concepts better.

Code Example 1

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

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

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

Code Example 2

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

Code Example 3

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

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

Learn ReactJs, React Native from akashmittal.com