Answers for "html onclick not working"

0

html onclick not working

Note to other developers coming across this, you can run into this if you use a reserved method names e.g. clear.
<!DOCTYPE html>
<html>
<body>
  <button onclick="clear()">Clear</button>
  <button onclick="clear2()">Clear2</button>
  <script>
  function clear() {
    alert('clear');
  }
  function clear2() {
    alert('clear2');
  }
  </script>
</body>
</html>
Posted by: Guest on May-18-2021

Code answers related to "html onclick not working"

Browse Popular Code Answers by Language