I have a javascript function embeded in my html code but when i'm running the page i get this error: Uncaught ReferenceError: myFunction is not defined.
I'm also using angularjs, so i have my index page and, as they explain, my partial page, and that functioon is in my partial page.
When i double click the web page from the folder i can run the script, but when i run the web api it present that error.
My javascript function:
<script type="text/javascript">
function myFunction() {
var x;
var r = confirm("Press a button!");
if (r == true) {
x = "You pressed OK!";
}
else {
x = "You pressed Cancel!";
}
document.getElementById("demo").innerHTML = x;
}
and how i call it:
<button onclick="myFunction()">Try it</button>
can anyone help me? thk