How to add a js function to ONSEN page load? (monaca)
<p>I would like an animation to autostart on page load. I'm in the Onsen UI V2 JS Splitter example within the ons-template in an ons-page. </p>

<p>I found that adding a script tag between the "/ons-page" and the "/ons-template" tags gets read (this took me quite some time... (-; )</p>

<p>I followed the <a href="https://onsen.io/v2/docs/js/page.html" rel="nofollow">guide</a> </p>

<pre><code>&lt;script&gt;
document.addEventListener("init", function(event) {
  if (event.target.id == "score.html") {
    Progress1();
  }
}, false);
&lt;/script&gt;
</code></pre>

<p>But nothing happened.</p>

<p>I changed it to: </p>

<p>.... html stuff</p>

<pre><code>    &lt;/ons-page&gt;
    &lt;script&gt;
  $(document).ready(function() {Progress1()});
    &lt;/script&gt;
  &lt;/ons-template&gt;
</code></pre>

<p>But now it cannot find a component from the HTML file and it says</p>

<pre><code>Uncaught Error: container does noet exist #container1 www/lib/jquery-3.1.0.slim.min.js:2
</code></pre>

<p>What can i do? I solved it now with a button. That proves it works, but is of course no auto start. </p>

<p>Any ideas...?
thanks</p>