title: Create an element dynamically in Vue.js
body: <p>I want to create a dynamic HTML template on click of a canvas.</p>
  <p>This is what I tried:</p>
  <pre><code>var btn = document.createElement(&quot;div&quot;);
  btn.classList.add(&quot;custom-signature-btn-row&quot;);
  btn.classList.add(&quot;d-flex&quot;);
  btn.innerHTML = `
      &lt;div class=&quot;btn-grid d-flex mr-2&quot;&gt;
          &lt;span class=&quot;element-icon drag-icon md-icon sign-btn&quot;&gt;drag_indicator&lt;/span&gt;
          &lt;button class=&quot;md-button md-primary md-theme-default button-custom-regular&quot; v-on:click=&quot;toggleSignature()&quot;&gt;
              Signature
          &lt;/button&gt;
          &lt;div class=&quot;signature-dropdow&quot; v-bind:class=&quot;{ active: isActive }&quot;&gt;
              &lt;ul&gt;
                  &lt;li&gt;
                      &lt;div class=&quot;md-layout-item&quot;&gt;
                          &lt;div class=&quot;md-field&quot;&gt;
                              &lt;label for=&quot;movie&quot;&gt;Assigned to Anyone&lt;/label&gt;
                              &lt;select name=&quot;movie&quot; class=&quot;md-select&quot; id=&quot;movie&quot;&gt;
                                  &lt;option class=&quot;md-option&quot; value=&quot;fight-club&quot;&gt;Fight Club&lt;/option&gt;
                                  &lt;option class=&quot;md-option&quot; value=&quot;godfather&quot;&gt;Godfather&lt;/option&gt;
                              &lt;/select&gt;
                          &lt;/div&gt;
                      &lt;/div&gt;
                  &lt;/li&gt;
              &lt;/ul&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  `;
  
  document.addEventListener('click', function(event) {
      if (event.target &amp;&amp; event.target.classList.contains(&quot;pdf-canvas&quot;)) {
          console.log(event.target.parentNode);
          event.target.parentNode.appendChild(btn);
      }
  });
  </code></pre>
  <p>The problem with above code is <code>v-bind</code> and <code>v-on</code> won't work with this approach.</p>