Call a class method from HTML
<p>How to call a method from the javascript class from html?</p>

<p>I not find solution for to call class method from html generated code using javascript. </p>

<p>I write small example for better understand.</p>

<pre><code>&lt;head&gt;
    &lt;script&gt;
        function MyClass() {
            var self = this;

            this.init = function() {
            document.getElementById('list').innerHTML = this.mainTemplate();
            };

            this.mainTemplate = function () {
                return '&lt;button id="start" class="btn btn-danger btn-lg" onclick="onStart()" type="button"&gt; value &lt;/button&gt;';
            };

            this.onStart = function onStart() {
                alert('bingo');
            };
        }
    &lt;/script&gt;
&lt;/head&gt;
&lt;body&gt;
    &lt;div id ="list"&gt; &lt;/div&gt;
        &lt;script&gt;
            var a = new MyClass();
                a.init();
                //a.onStart();
        &lt;/script&gt;
&lt;/body&gt;
</code></pre>

<p>I have tried everything that comes to mind, like ...</p>

<ol>
<li>onStart()</li>
<li>self.onStart()</li>
<li>this.onStart()</li>
<li>MyClass.onStart()</li>
<li>MyClass.prototype.onStart()</li>
<li>a.onStart</li>
<li>MyClass.onStart</li>
</ol>