I have seen many threads related to my question title.
Here is HTML Codes :
In jsFiddle by default the code you type into the script block is wrapped in a function executed on window.onload:
Because of this, your function myFunc
is not in the global scope so is not available to your html buttons. By changing the option to No-wrap in
as Sergio suggests your code isn't wrapped:
and so the function is in the global scope and available to your html buttons.