I'm testing some javascript on jsfiddle and for some reason I can't get a function to fire on a button click. Any advice?
In the Frameworks & Extensions
panel, set onLoad
to No wrap - in <body>
.
It took me a while to figure this out.
You have configured JSFiddle to wrap the code in an onload event handler. Consequently the function you are trying to call onclick
is out of scope.
Don't use intrinsic event attributes. Use jQuery's (since you are using jQuery already) event binding instead.
©2020 All rights reserved.