how to call a function on click of button in javascript code example
Example 1: how to call a function with a button in javascript
<script>
function myFunction()
{
document.write("<h1>HELLO</h1>")
}
</script>
<button onclick="myFunction()">Click</button>
Example 2: calling function on click html
<img src="hospital.png" id="hospitals" onclick="damarkers();">