-3

Trying to call a function called "clear()" in javascript but it won't work, the function works when put into the console but won't when I click the button.

Andrew Neate
  • 109
  • 1
  • 9

1 Answers1

1

Its a problem with your function name, try change it to clearMe()

Use the link below, the code works fine..

https://www.w3schools.com/jsref/tryit.asp?filename=tryjsref_onclick

..if you change the function name to clear it does not.

J Foley
  • 1,038
  • 1
  • 17
  • 30
  • Thought it might have been a reserved word in javascript, doesn't look to be but looks like it still causes issues.. http://stackoverflow.com/questions/7165570/is-clear-a-reserved-word-in-javascript – J Foley Mar 28 '17 at 10:29
  • No problem, glad it helped! – J Foley Mar 28 '17 at 10:48