title: JavaScript to remove all hidden elements but one
body: <p>Someone helped me find JavaScript <a href="https://stackoverflow.com/questions/7745191/javascript-removing-contents-of-form-hidden-by-animatedcollapse-hide">code to remove hidden form fields from submission</a> and <a href="https://stackoverflow.com/questions/7747209/csrf-error-in-django-after-removal-of-hidden-fields/7747430#7747430">code that ignores a certain field</a> that I don't want removed (whether it's hidden or not):</p>
  
  <pre><code>$("form").submit(function() {
  $(this).find(":hidden").remove(); // hide hidden elements before submitting
  });
  </code></pre>
  
  <p>and</p>
  
  <pre><code>:not(input[name=csrfmiddlewaretoken])
  </code></pre>
  
  <p>However, I can't for the life of me figure out how to put these together. I'm sure it's a basic JavaScript question, but I can't seem to piece these together.</p>
  
  <p>Does anyone know how to remove all hidden form entries <em>not named</em> <code>csrfmiddlewaretoken</code>? If you do, I'd really appreciate it.</p>
  
  <p>Thanks a lot.</p>