Check out example codes for "calling function on click html". It will help you in understanding the concepts better.
Code Example 1
<button onClick="script">
Code Example 2
<img src="hospital.png" id="hospitals" onclick="damarkers();">
Code Example 3
var myElem = document.getElementByID('ElemID');
myElem.onclick = function() {
//do stuff
}
Code Example 4
<button onclick="myFunction()">Click me</button>
<p id="demo"></p>
<script>
function myFunction() {
document.getElementById("demo").innerHTML = "Hello World";
}
</script>
Learn ReactJs, React Native from akashmittal.com