How to call a function in Windows 8 app?

0

I created a function like this:

text: function () { 
    document.getElementById("id").innerText = "Hello";
}

I tried to call this function from another function like this and it doesn't work:

anotherFunction: function () {
    this.text();
}

The error I get:

Unhandled exception at line 89, column 21 in ms-appx://b9f1ea0e-9eeb-41e4-a788-92c282715e21/pages/game/game.js

0x800a01b6 - JavaScript runtime error: Object doesn't support property or method 'text45'

Note: text45 is my function name.

What do I do wrong?

javascript
html
windows-store-apps
windows-8.1
asked on Stack Overflow Jun 3, 2015 by ofir2471 • edited Jun 3, 2015 by ofir2471

1 Answer

0

I solved it. There is no way (From what I know) to call a function that is not in the function itself. When I write the function like a regular function in the function itself it worked. Example for what I found:

anotherFunction: function () {
    function textchange() {
        document.getElementById("id").innerText = "Hello";
    }
    text();
}
answered on Stack Overflow Jun 4, 2015 by ofir2471

User contributions licensed under CC BY-SA 3.0