Results 1 to 3 of 3
  1.    #1  
    I was wondering why the following code wouldn't work:

    function FirstAssistant() {


    FirstAssistant.prototype.setup = function() {;


    FirstAssistant.prototype.updateTotal = function() {;
    Assuming I have the following code in the html:

    <div id="main" class="palm-hasheader">
    <div class="palm-header">Counter</div>
    <div id="count" class="palm-body-text">count</div>
    The result is a bit of text that just reads '1' instead of counting up once ever 100 milliseconds.

    I'm very new to javascript unfortunately. My background is primarily in C# and Java. Any help would be greatly appreciated! Thanks!
  2. #2  
    Your setinterval should look more like this.

    window.setInterval(this.updateTotal.bind(this), 5000);
  3. mosdl's Avatar
    781 Posts
    Global Posts
    787 Global Posts
    The problem is:


    you are calling the method - you want to pass in a reference, just as the previous post mentions.

Posting Permissions