title: How to add onclick event to dynamic a href with jquery
body: <p>For example i have such code:</p>
  
  <pre><code>$("#total").html("Price $&lt;span&gt;" + value + "&lt;/span&gt;");
  </code></pre>
  
  <p>And i also want to add a href button there</p>
  
  <pre><code>$("#total").html("Price $&lt;span&gt;" + value + "&lt;/span&gt;&lt;a id='remove' href='#'&gt;remove&lt;/&gt;);
  </code></pre>
  
  <p>But how i may add <code>onclick</code> event for that a href?</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>I really like that solution:</p>
  
  <pre><code>//Create the link to remove the item beforehand, and add the onclick event handler.
  var removeLink = $("&lt;a id='remove' href='#'&gt;remove&lt;/a&gt;").click(function(e) {
      //Click event handler here.
  });
  
  $("#total").html("Price $&lt;span&gt;" + value + "&lt;/span&gt;");  //Create the price value
  $("#total").append(removeLink);  //Add the remove link.
  </code></pre>
  
  <p>Because there is a lot of remove links going to be on my form, but i have a question how to pass any parameters to that click function in such case?</p>