title: Using thymeleaf variable in onclick attribute
body: <p>In my current spring-boot project, I have one view with this html code:</p>
  
  <pre><code>&lt;button type="button" class="btn btn-primary" onclick="upload()" th:utext="#{modal.save}"&gt;&lt;/button&gt;
  </code></pre>
  
  <p>in the <code>onclick</code> attribute, the call for the function <code>upload()</code> should have one parameter, which value is stored in the thymeleaf variable <code>${gallery}</code>.</p>
  
  <p>Anyone can tell mehow to use the expression in the above command?</p>
  
  <p>I already try this:</p>
  
  <ul>
  <li><p><code>th:onclick="upload(${gallery)"</code></p></li>
  <li><p><code>th:attr="onclick=upload(${gallery)"</code></p></li>
  </ul>
  
  <p>None of this worked.</p>