title: how to pass dynamic parameters to jquery function
body: <p>I want to pass some dynamic paramters to jquery onClick event. Before, I used this HTML and JavaScript:</p>
  
  <pre class="lang-html prettyprint-override"><code>&lt;!-- HTML --&gt;
  &lt;a id="link123" href="link1" onClick="javascript:func1(${param1},${param2});"&gt;123&lt;/a&gt;
  </code></pre>
  
  <pre class="lang-js prettyprint-override"><code>/* JavaScript */
  func1(param1,param2) {
     // do something
  }
  </code></pre>
  
  <p>The parameters <code>param1</code> and <code>param2</code> come from backend code and are dynamic. How I get this is not important here.</p>
  
  <p>After using jQuery, I have this HTML and JS:</p>
  
  <pre class="lang-html prettyprint-override"><code>&lt;a href="link123"&gt;
  &lt;input type="hidden" id="param1" value="${param1}"/&gt;
  &lt;input type="hidden" id="param2" value="${param2}"/&gt;
  </code></pre>
  
  <pre class="lang-js prettyprint-override"><code>$(document).ready(function() {
    $("#link123").click(function() {
      var param1 = $("#param1")[0].value;
      var param1 = $("#param1")[0].value;
      func1(param1,param2);
    });
  });
  
  func1(param1,param2) {
    //do something
  }
  function func1 is there as before.
  </code></pre>
  
  <p>I'm not happy with this solution (passing params as inline hidden values). What are other, better ways to pass dynamic parameters to jQuery, in situation like this?</p>