How to call JavaScript function with HTML button click

1 Answer

0 votes
<!DOCTYPE html>
<html>
<body>


<button type="button" onclick="jsFunction()">Click</button>

<p id="p_id">Paragraph Tag</p>

<script>
function jsFunction() { 
  document.getElementById("p_id").innerHTML = "JavaScript";
}
</script>

</body>
</html>

 



answered Dec 26, 2018 by avibootz
edited Dec 26, 2018 by avibootz
...