JavaScript function not found on jsfiddle

Viewed 1478

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?

2 Answers

You need to wrap the function script inside <head> . Otherwise your script is not invoked.

Change the settings as

LOAD TYPE - Wrap in <Head>

WORKING DEMO

enter image description here

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>
Related