Run Javascript code every time , we open the page

Hi I am making timesheet app :As follow:


Once I clicked the start button it takes to Edit Detail Page: As follow:

Here the Duration is Clock which is supposed to start on opening of this page. To run this clock I have use following javascript on this page :

For the first time when I click “Start Task”, the timer is working but from second time (click of Start Task) , the timmer is not working , . Here from my understanding , from second time when we go to this page by clicking “Start Task” the javascript of the page is not loading.

Second issue:
In similar way If i go back and come back to this same page , the javascript is not loaded.

So My question is how can I make the JavaScript running every time when I go to that page.

Can you try putting your code like this:

TB.render('component_3', function(data) {    
  //PUT YOUR CODE HERE
});

Replace the component_3 with a component on the page you wish to wait for before running the code. You can see the component ids by hovering over the component in the builer.