Uncaught SyntaxError: Failed to execute 'querySelector' on 'Document'
<pre><code>&lt;button id=&quot;'+item['id']+'&quot; class=&quot;btnDeactivateKeyInChildPremiumCustomer waves-effect waves-light&quot;&gt;ok&lt;/button&gt;
</code></pre>
<p>I used above code for generating button inside of jquery each function.The button created dynamically and when i clicked the button , it should show the progress on the button.
Im using this <a href="https://github.com/hakimel/Ladda" rel="noreferrer">Ladda Button Loader</a>.</p>
<pre><code>btnDeactivateKeyInChildPremiumCustomerClick : function(event){
   var id = event.currentTarget.id;
   var btnProgress = Ladda.create(document.querySelector('#'+id));
   // btnProgress.start(); or btnProgress.stop();
}
</code></pre>
<p>And then i passed the button the event handler catch the event process the above function.Inside that function it will create a <strong>btnProgress</strong> object.
After that i can call start() or stop() functions.I have successfully worked the in the case of only one button without creating the button dynamically inside each . But in the for each case it is showing some errors while executing <strong>var btnProgress = Ladda.create(document.querySelector('#'+id));</strong></p>
<p><strong>Error</strong></p>
<pre><code>Uncaught SyntaxError: Failed to execute 'querySelector' on 'Document': '#22' is not a valid selector.
</code></pre>