Timwi
0
Q:

run a function when a button has the onclick

<script>
function myFunction() {
  alert("ALERT THIS FUNCTION HAS RUNNED");
}
</script>
<button onclick="myFunction">click to run function</button>
3
 document.getElementById("Save").onclick = function ()
    {
     alert("hello");
     //validation code to see State field is mandatory.  
    }
2
var element = document.getElementById("elem");
element.onclick = function(event) {
  console.log(event);
}
2
<script>
 function myFunction() {
   alert("ALERT");
 }
</script>
<button onclick="myFunction">Click</button>
1
  <img src="hospital.png" id="hospitals" onclick="damarkers();">
-1

New to Communities?

Join the community