Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR HTML

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>
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #html #onclick #working
ADD COMMENT
Topic
Name
5+4 =