Answers for "how to make a button call a javascript function"

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>
Posted by: Guest on November-12-2020
7

onclick a tag

<a href='http://www.google.com' onclick='return check()'>check</a>

<script type='text/javascript'>
function check() {
    return false;
}
</script>
Posted by: Guest on March-05-2020
14

javascript onclick button

var button = document.querySelector('button');
button.onclick = function() {
  //do stuff
}
Posted by: Guest on March-10-2020
9

javascript click event

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

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

<script>
function myFunction() {
  document.getElementById("demo").innerHTML = "Hello World";
}
</script>
Posted by: Guest on April-10-2020
0

how to make a button execute a javascript function

<button onclick"function name">Click</button>
Posted by: Guest on March-27-2021
0

calling function on click html

<img src="hospital.png" id="hospitals" onclick="damarkers();">
Posted by: Guest on June-27-2020

Code answers related to "how to make a button call a javascript function"

Code answers related to "Javascript"

Browse Popular Code Answers by Language