I have 2 script blocks (written in the same file), however I am unable to call the function written in another script block.
<!DOCTYPE html>
<html>
<head>
<title>Just A Test</title>
</head>
<body>
<div class="app">
<h1>Just A Test</h1>
</div>
<div data‐role="main" class="ui‐content">
<form name="testForm" id="testForm">
<div class="ui‐field‐contain">
First greeting:
<script type="text/javascript">
greetings1(); //ERROR AT THIS LINE
</script>
<p></p>
</div>
</form>
</div>
<script type="text/javascript">
function greetings1(){
alert("Hello ONE");
}
</script>
</body>
</html>
The error I get is:
Error: 'greetings1' is undefined
My question is: What is causing the browser not being able to see the declared function? I have spent hours and tried ways such as moving the script block to the head, but the problem still persist.