title: How can I set the value of a hidden input field using Jquery?
body: <p>I am attempting to set the value of a hidden input field to the same as the value of a clicked link.</p>
  
  <p>This is what I have attempted which doesnt work:</p>
  
  <pre><code>$(document).ready(function(){
  $(".delete_link").click(function(){
          var deleteID = $(this).attr("data-value"); 
          $("#delete_value").attr("value") = deleteID;
      });
  });
  </code></pre>
  
  <p>The variable <code>deleteID</code> is correctly set.</p>
  
  <p>and the form for reference:</p>
  
  <pre><code>&lt;form name="delete_form" action="delete_post.php" method="POST"&gt;
      &lt;p&gt;Please confirm you want to delete this post.&lt;/p&gt;
      &lt;input type="submit" id="delete_submit" name="delete_submit" value="confirm" /&gt;
      &lt;input type="hidden" id="delete_value" value="" /&gt;
  &lt;/form&gt;
  </code></pre>