Reputation: 11120
Very simple minimal jsfiddle example:
https://jsfiddle.net/a9f2j4xo/
Clicking the button should invoke the Bla()
function.
When I click the button the console says
ReferenceError: Bla is not defined.
Who or what is malfunctioning here, jsfiddle or my brain?
Upvotes: 4
Views: 1628
Reputation: 737
This seems to be something weird. Because on putting it inside script tag it is working. See js fiddle here https://jsfiddle.net/a9f2j4xo/
<button onclick='Bla()'>
Test
</button>
<script>
function Bla()
{
alert('yes');
}
</script>
Upvotes: 0
Reputation: 222552
You need to wrap the function script inside <head>
. Otherwise your script is not invoked.
Change the settings as
LOAD TYPE - Wrap in <Head>
Upvotes: 13